IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 人工智能 -> tensorflow.python.framework.errors_impl.InvalidArgumentError: indices[0] = 82620 is not in [0 81648 -> 正文阅读

[人工智能]tensorflow.python.framework.errors_impl.InvalidArgumentError: indices[0] = 82620 is not in [0 81648

最近在复现别人代码的时候,遇到如下问题:

Traceback (most recent call last):
? File "/home/robot/.virtualenvs/tensor/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1365, in _do_call
??? return fn(*args)
? File "/home/robot/.virtualenvs/tensor/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1350, in _run_fn
??? target_list, run_metadata)
? File "/home/robot/.virtualenvs/tensor/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1443, in _call_tf_sessionrun
??? run_metadata)
tensorflow.python.framework.errors_impl.InvalidArgumentError: indices[0] = 82620 is not in [0, 81648)
?? ? [[{{node ROI/GatherV2_2}}]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
? File "/home/robot/文档/ye/code/1dense-clutter-grasp-master/algorithm/detection_algorithm.py", line 407, in <module>
??? predict = GraspAlgorithm(parameters)
? File "/home/robot/文档/ye/code/1dense-clutter-grasp-master/algorithm/detection_algorithm.py", line 77, in __init__
??? self.model.detect([null_image], verbose=1)
? File "/home/robot/文档/ye/code/1dense-clutter-grasp-master/algorithm/mrcnn/model.py", line 2544, in detect
??? self.keras_model.predict([molded_images, image_metas, anchors], verbose=0)
? File "/home/robot/.virtualenvs/tensor/lib/python3.6/site-packages/keras/engine/training.py", line 1713, in predict
??? verbose=verbose, steps=steps)
? File "/home/robot/.virtualenvs/tensor/lib/python3.6/site-packages/keras/engine/training.py", line 1269, in _predict_loop
??? batch_outs = f(ins_batch)
? File "/home/robot/.virtualenvs/tensor/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 2273, in __call__
??? **self.session_kwargs)
? File "/home/robot/.virtualenvs/tensor/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 956, in run
??? run_metadata_ptr)
? File "/home/robot/.virtualenvs/tensor/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1180, in _run
??? feed_dict_tensor, options, run_metadata)
? File "/home/robot/.virtualenvs/tensor/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1359, in _do_run
??? run_metadata)
? File "/home/robot/.virtualenvs/tensor/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1384, in _do_call
??? raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: indices[0] = 82620 is not in [0, 81648)
?? ? [[node ROI/GatherV2_2 (defined at /.virtualenvs/tensor/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py:1748) ]]

Original stack trace for 'ROI/GatherV2_2':
? File "/文档/ye/code/1dense-clutter-grasp-master/algorithm/detection_algorithm.py", line 407, in <module>
??? predict = GraspAlgorithm(parameters)
? File "/文档/ye/code/1dense-clutter-grasp-master/algorithm/detection_algorithm.py", line 70, in __init__
??? config=config_model)
? File "/文档/ye/code/1dense-clutter-grasp-master/algorithm/mrcnn/model.py", line 1841, in __init__
??? self.keras_model = self.build(mode=mode, config=config)
? File "/文档/ye/code/1dense-clutter-grasp-master/algorithm/mrcnn/model.py", line 1969, in build
??? config=config)([rpn_class, rpn_bbox, anchors])
? File "/.virtualenvs/tensor/lib/python3.6/site-packages/keras/engine/topology.py", line 602, in __call__
??? output = self.call(inputs, **kwargs)
? File "/文档/ye/code/1dense-clutter-grasp-master/algorithm/mrcnn/model.py", line 298, in call
??? names=["pre_nms_anchors"])
? File "/文档/ye/code/1dense-clutter-grasp-master/algorithm/mrcnn/utils.py", line 835, in batch_slice
??? output_slice = graph_fn(*inputs_slice)
? File "/文档/ye/code/1dense-clutter-grasp-master/algorithm/mrcnn/model.py", line 296, in <lambda>
??? pre_nms_anchors = utils.batch_slice([anchors, ix], lambda a, x: tf.gather(a, x),
? File "/.virtualenvs/tensor/lib/python3.6/site-packages/tensorflow_core/python/util/dispatch.py", line 180, in wrapper
??? return target(*args, **kwargs)
? File "/.virtualenvs/tensor/lib/python3.6/site-packages/tensorflow_core/python/ops/array_ops.py", line 3956, in gather
??? params, indices, axis, name=name)
? File "/.virtualenvs/tensor/lib/python3.6/site-packages/tensorflow_core/python/ops/gen_array_ops.py", line 4082, in gather_v2
??? batch_dims=batch_dims, name=name)
? File "/.virtualenvs/tensor/lib/python3.6/site-packages/tensorflow_core/python/framework/op_def_library.py", line 794, in _apply_op_helper
??? op_def=op_def)
? File "/.virtualenvs/tensor/lib/python3.6/site-packages/tensorflow_core/python/util/deprecation.py", line 507, in new_func
??? return func(*args, **kwargs)
? File "/.virtualenvs/tensor/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py", line 3357, in create_op
??? attrs, op_def, compute_device)
? File "/.virtualenvs/tensor/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py", line 3426, in _create_op_internal
??? op_def=op_def)
? File "/.virtualenvs/tensor/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py", line 1748, in __init__
??? self._traceback = tf_stack.extract_stack()

找了好久也没找到解决方法,最后发现一个类似的问题,解决方法是:在model.py中加上两行

mask = tf.greater(tf.shape(anchors)[1], ix, name="bool_mask")
ix = tf.stack([tf.boolean_mask(ix, mask)])

?

?

  人工智能 最新文章
2022吴恩达机器学习课程——第二课(神经网
第十五章 规则学习
FixMatch: Simplifying Semi-Supervised Le
数据挖掘Java——Kmeans算法的实现
大脑皮层的分割方法
【翻译】GPT-3是如何工作的
论文笔记:TEACHTEXT: CrossModal Generaliz
python从零学(六)
详解Python 3.x 导入(import)
【答读者问27】backtrader不支持最新版本的
上一篇文章      下一篇文章      查看所有文章
加:2021-12-02 16:45:14  更:2021-12-02 16:46:11 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年11日历 -2024/11/27 2:38:42-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码