当前位置: 代码迷 >> 综合 >> SKU110K_CVPR19复现步骤(train and test)
  详细解决方案

SKU110K_CVPR19复现步骤(train and test)

热度:110   发布时间:2023-10-26 01:11:03.0

代码参考:https://github.com/eg4000/SKU110K_CVPR19

1.可行环境

ubuntu16.04python3.5
keras==2.2.4
keras-resnet
six
scipy
Pillow
pandas
tensorflow-gpu
tqdm
opencv-python==3.1.0.4
windows(only cpu)python3.6
keras==2.2.4
keras-resnet
six
scipy
Pillow
pandas
tensorflow==1.12.0
tqdm
opencv-python==3.2.0.6

将pyhon库(如果不想影响其他地环境地话,可以创建virtualenv虚拟环境),写入新建地requirements.txt。

运行下面命令:

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt

2.做以下修改

1.copy ./object_detector_retinanet/keras_retinanet/bin/train.py class_mappings.csv to ./
cp ./object_detector_retinanet/keras_retinanet/bin/train.py class_mappings.csv  ./

 

2.modify ./object_detector_retinanet/utils.py line42 or 45 to our own datapath

3.add 2 lines in ./object_detector_retinanet/utils/image.py line24-25 

   此处参考:https://github.com/eg4000/SKU110K_CVPR19/issues/23 

from PIL import ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True

4.in our datapath/annotations/ delete the first line of csv file

 删除标题栏,如下:

5.train 1st step run at ./            
python -u ./train.py csv           

   指定gpu

python -u ./train.py --gpu 3 csv           

成功的情况可以去看我开的issue.

   可以训练了:

For windows:

 

For ubuntu16.04:

6.train 2nd step run at ./            
cp ./object_detector_retinanet/keras_retinanet/bin/train_iou.py ./
python -u ./train_iou.py --weights snapshot/Tue_May_26_08_17_14_2020/resnet50_csv_05.h5 csv

7. copy ./object_detector_retinanet/keras_retinanet_bin/predict.py to ./
8.test run at ./
may we'll mat this(“ 'dict' object has no attribute 'iteritems' ”):
vim ./object_detector_retinanet/keras_retinanet/utils/CollapsingMoG.py
line 190
change:
for j, t_vals in clusters.iteritems():
to:
for j, t_vals in clusters.items():
test
python -u ./predict.py csv  "./SKU110K/snapshot/Thu_May_28_02:36:24_2020/iou_resnet50_csv_01.h5" --hard_score_rate=0.5 

 we'll get detection result demo.


First three step I've changed.The second step you need modify yourself.

 

  相关解决方案