Real-world Multi-object, Multi-grasp Detection论文Demo复现
Posted 萌萌滴太阳
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Real-world Multi-object, Multi-grasp Detection论文Demo复现相关的知识,希望对你有一定的参考价值。
前言 :
本文主要参考这篇博客,然后根据自己的实际复现中遇到的问题写出
1电脑的环境
ubuntu16.04++tensorflow-gpu1.12.0+cuda9.0+cudnn7
2
https://github.com/ivalab
#论文资源的主网址,其中 grasp_multiObject_multiGrasp 是指导复现 demo的
3 缺少easydict, numpy, sharply等等包
解决:直接pip install <相应包>
注:使用豆瓣镜像更快
pip install <相应包> -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
4 找不到目录或文件
下载下来的文件,里面有些代码中指定的文件夹没有,有些文件不在代码指定的文件夹里。
解决 :按照报错信息,将缺失的文件夹补上,将文件移到指定位置即可。
5
./tools/demo_graspRGD.py --net res50 --dataset grasp
要在grasp_multiObject_multiGrasp路径下运行
复现过程中的具体问题
错误主要集中在Demo的第五步Run demo
一
原因 :ros和cv2环境相冲突
解决办法 :在需要运行的python文件(即使用import cv2的python文件)中,添加以下代码:(添加在import cv2前,最好紧贴这添加在它上面,因为一些语句需要放在最上面,如from __future__ imports must occur at the beginning of the file
)
import sys
sys.path.remove('/opt/ros/kinetic/lib/python2.7/dist-packages')
参照这篇博客
二 pip install cv2 出错
解决 :pip install opencv-python -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
三
Traceback (most recent call last):
File "./tools/demo_graspRGD.py", line 196, in <module>
tag='default', anchor_scales=[8, 16, 32])
File "/home/litong/grasp_multiObject_multiGrasp/tools/../lib/nets/network.py", line 306, in create_architecture
rois, cls_prob, bbox_pred = self.build_network(sess, training)
File "/home/litong/grasp_multiObject_multiGrasp/tools/../lib/nets/resnet_v1.py", line 155, in build_network
scope=self._resnet_scope)
File "/home/litong/anaconda3/lib/python3.5/site-packages/tensorflow/contrib/slim/python/slim/nets/resnet_v1.py", line 207, in resnet_v1
net = resnet_utils.stack_blocks_dense(net, blocks, output_stride)
File "/home/litong/anaconda3/lib/python3.5/site-packages/tensorflow/contrib/framework/python/ops/arg_scope.py", line 182, in func_with_args
return func(*args, **current_args)
File "/home/litong/anaconda3/lib/python3.5/site-packages/tensorflow/contrib/slim/python/slim/nets/resnet_utils.py", line 215, in stack_blocks_dense
net = block.unit_fn(net, rate=1, **unit)
TypeError: bottleneck() argument after ** must be a mapping, not tuple
在测试的时候发现
print(type(unit)) #测试格,输出的格式是tuple
print (unit) #输出为(256, 64, 1),是一个元组
所以解决问题的思路应该是把格式从tuple转成mapping,并且还得是变量类型的转换。
在翻上去查到了unit的各个含义以后,见 https://blog.csdn.net/stesha_chen/article/details/81870591
解决 :在文件/anaconda3/lib/python3.5/site-packages/tensorflow/contrib/slim/python/slim/nets/resnet_utils.py"
, 215行,
net = block.unit_fn(net, rate=1, **unit)
前面添加
unit='depth':unit[0],'depth_bottleneck':unit[1],'stride':unit[2] #强行把格式从tuple改成mapping
若改完之后出现
Traceback (most recent call last):
File "./tools/demo_graspRGD.py", line 31, in <module>
from nets.resnet_v1 import resnetv1
File "/home/litong/grasp_multiObject_multiGrasp/tools/../lib/nets/resnet_v1.py", line 14, in <module>
from tensorflow.contrib.slim.python.slim.nets import resnet_utils
File "/home/litong/anaconda3/lib/python3.5/site-packages/tensorflow/contrib/slim/python/slim/nets/resnet_utils.py", line 215
unit='depth':unit[0],'depth_bottleneck':unit[1],'stride':unit[2]
^
TabError: inconsistent use of tabs and spaces in indentation
注意 :在添加上一句代码时,制表符和空格符不要一起使用
四
原因 :
读入图片路径不对,所以im=imread(…)没能读入图片,即im没得到的数据,为空,是None Type对象,而None Type对象没有参数astype
(关于'NoneType' object has no attribute ...
此类的错误,具体查看这篇博客)
前面根据代码提示将pcd0100r_rgd_preprocessed_1.png
文件移到了/grasp_multiObject_multiGrasp/data/demo/results_all_cls
,而代码中读入的是grasp_multiObject_multiGrasp/data/demo/
解决
根据错误提示,找到./tools/demo_graspRGD.py
然后打开修改109行为
im_file = os.path.join(cfg.DATA_DIR, 'demo/results_all_cls', image_name)
成功
==================================================
在pycharm调试demo_graspRGD过程中出现问题
一
明明有numpy,却出错
importerror :no modle numpy
原因: 系统中有默认的numpy,而安装tensorflow-gpu会携带安装一个适合该tensorflow版本的numpy,并且默认的numpy卸载不掉,卸载携带安装的numpy,默认numpy和tensorflow版本又不匹配 ,导致两个numpy冲突。
解决 :新建一个conda 环境即可
二
OSError: output/res50/train/default/res50_faster_rcnn_iter_240000.ckpt.meta not found.
Did you download the proper networks from our server and place them properly?
但是相应文件夹里有对应文件
错误原因 :pycharm 的工作路径设置不对,应设置在根目录grasp_multiObject_multiGrasp下
解决 : 更改pycharm 的工作路径为grasp_multiObject_multiGrasp,更改方法见博客
以上是关于Real-world Multi-object, Multi-grasp Detection论文Demo复现的主要内容,如果未能解决你的问题,请参考以下文章
FairMOT--A Simple Baseline for Multi-Object Tracking
SQL调优指南笔记20:Improving Real-World Performance Through Cursor Sharing
SQL调优指南笔记20:Improving Real-World Performance Through Cursor Sharing
Survey: A Survey on Image Tampering and Its Detection in Real-world Photos 图像仿冒
Survey: A Survey on Image Tampering and Its Detection in Real-world Photos 图像仿冒