Mask R-CNN在宠物数据集上没有学习,即使没有对代码进行任何更改

2024-09-27 21:24:29 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试重新训练COCO上的预训练模型,以便从Pet数据集中检测图像。我跟着辅导开始了培训。但从结果来看,模型没有得到很好的训练

重新创建步骤:

  1. git clone https://github.com/cocodataset/cocoapi.git
  2. conda create --name tf_test python=3.6
  3. conda activate tf_test
  4. pip install tensorflow
  5. pip install pillow, lxml, jupyter, matplotlib, opencv, contextlib2
  6. 下载protoc-3.9.0-win32.zip解压到Program Files\Google Protobuf\
  7. 将程序文件\Google Protobuf\bin添加到路径
  8. for /f %i in ('dir /b object_detection\protos\*.proto') do protoc object_detection\protos\%i --python_out=.
  9. 创建了环境变量PYTHONPATH,包含3个条目:TF\models、TF\models\research\slim、TF\models\research\object\u detection
  10. conda install -c anaconda cython
  11. pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
  12. 重新启动
  13. cd TF\models\research\object_detection
  14. jupyter notebook
  15. 打开对象检测教程.ipynb
  16. 添加的导入: 从object\u detection.utils导入标签\u map\u util 从object\u detection.utils导入可视化\u utils作为vis\u util
  17. 在object\u detection中进行了演示,没有任何问题(I tensorflow/core/platform/cpu\u feature\u guard.cc:142)您的cpu支持该tensorflow二进制文件未编译为使用的指令:AVX2)

目录结构:

  • TF公司
    • 模型
    • 培训
      • pet\u数据集
      • 宠物档案
      • 型号
      • 检查点

然后:

  1. 下载的宠物数据集https://www.robots.ox.ac.uk/~vgg/data/pets/
  2. 将内容粘贴到pet\u数据集中
  3. cd TF
  4. conda activate tf_test
  5. 在create\u pet\u tf\u record.py中手动将faces\u only设置为False
  6. 23
python models\research\object_detection\dataset_tools\create_pet_tf_record.py
    --data_dir=training\pet_dataset 
    --output_dir=training\pet_tf_records 
    --mask_type png 
    --label_map_path=models\research\object_detection\data\pet_label_map.pbtxt
  1. 从github下载mask\u rcnn\u inception\u v2\u coco到TF\training\model
  2. 将配置从models/research/object\u detection/sample/configs/移动到TF\training\model
  3. 将班级编号改为37
  4. 相应地更改了配置文件中的路径

  5. 28
python models\research\object_detection\model_main.py 
    --model_dir=training\checkpoints 
    --num_train_steps 1000 
    --pipeline_config_path=training\model\mask_rcnn_inception_v2_coco.config
  1. 让我们训练20小时

我得到了以下结果,在张力板上检查时,mAP从训练开始逐渐下降: 我得到以下结果:

Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.001
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.003
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.000
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = -1.000
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.001
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.019
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.030
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.030
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = -1.000
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.030
I0716 07:35:44.988143  3956 evaluation.py:275] Finished evaluation at 2019-07-16-07:35:44
I0716 07:35:44.988143  3956 estimator.py:2039] Saving dict for global step 196: DetectionBoxes_Precision/mAP = 0.00063327036, DetectionBoxes_Precision/mAP (large) = 0.00067928224, DetectionBoxes_Precision/mAP (medium) = -1.0, DetectionBoxes_Precision/mAP (small) = -1.0, DetectionBoxes_Precision/mAP@.50IOU = 0.0025016854, DetectionBoxes_Precision/mAP@.75IOU = 0.0002254508, DetectionBoxes_Recall/AR@1 = 0.018629802, DetectionBoxes_Recall/AR@10 = 0.030065296, DetectionBoxes_Recall/AR@100 = 0.030065296, DetectionBoxes_Recall/AR@100 (large) = 0.030065296, DetectionBoxes_Recall/AR@100 (medium) = -1.0, DetectionBoxes_Recall/AR@100 (small) = -1.0, Loss/BoxClassifierLoss/classification_loss = 0.11927358, Loss/BoxClassifierLoss/localization_loss = 0.10073859, Loss/BoxClassifierLoss/mask_loss = 2.1088743, Loss/RPNLoss/localization_loss = 0.11095625, Loss/RPNLoss/objectness_loss = 0.54912615, Loss/total_loss = 2.988967, global_step = 196, learning_rate = 0.0002, loss = 2.988967

拜托,你有什么建议我哪里出错了


Tags: mapobjectmodelstfareaprecisionaraverage

热门问题