mmdetection的安装和训练、测试didi数据集的步骤(含结果)

编程入门 行业动态 更新时间:2024-10-08 22:13:29

mmdetection的安装和训练、测试didi数据集的<a href=https://www.elefans.com/category/jswz/34/1771434.html style=步骤(含结果)"/>

mmdetection的安装和训练、测试didi数据集的步骤(含结果)

目录

安装pytorch 1.3

安装mmcv

安装mmdet

安装额外的包

安装cocoapi

根据数据集修改文件

将环境持久化

运行didi训练脚本

测试didi数据集

常用ubuntu命令

实验结果图


安装pytorch 1.3

conda create -n open-mmlab python=3.7 -y
conda init bash
conda activate open-mmlabconda install pytorch=1.3.1 cudatoolkit=9.2 torchvision=0.4.2 -c /

安装mmcv

pip install mmcv-full==1.0.5 -f .3.0/index.html

安装mmdet

1、pip install mmdet==2.3.0
#github下载mmdetection的2.3.0版本的源码

安装额外的包

pip install Pillow==6.2.2
pip install cython

安装cocoapi

git+.git  #手动下载离线安装包
python setup.py install

根据数据集修改文件

mmdetection/mmdet/datasets/coco.py #coco修改成自定义数据集类别
mmdetection/mmdet/core/evaluation/class_names.py #coco修改成自定义数据集类别
mmdetection/mmdet/configs/_bash_/models/faster_rcnn_r50_fpn.py #修改类别数,num_classes=12
# 修改方法1:vim ;方法2:cp 到/home/aistdio 可以直接打开
mmdetection/mmdet/datasets/custom.py #注释下面两行
#if self.custom_classes:
#	self.data_infos=self.get_subset_by_classes()

将环境持久化

cp -r open-mmlab/ /home/aistudio/external-libraries #复制
cp -r  /home/aistudio/external-libraries/open-mmlab /opt/conda/env #复制回去
# in ~/.bashrc  或者修改conda env的路径
export CONDA_ENVS_PATH=/home/aistudio/external-libraries/open-mmlab

运行didi训练脚本

python tools/train.py configs/faster_rcnn/faster_rcnn_r50_fpn_1x_didi.py
#2、手动下载 .pth
#3、复制文件到 cp /home/aistudio/.cache/torch/checkpoints/resnet50-19c8e357.pth

测试didi数据集

python tools/test.py configs/faster_rcnn/faster_rcnn_r50_fpn_soft_nms_1x_didi.py ./work_dirs/faster_rcnn_r50_fpn_soft_nms_1x_didi/latest.pth --format-only --options "jsonfile_prefix=./test_results" --show-dir "./show_result"# 报错1:ModuleFoundError no module named 'tools'
# 报错1解决方法1:注释掉import tools 和使用的两行,因为if条件没有进去
# 报错1解决方法2:手动将tool文件的函数复制到当前文件中# 报错2:IndexError:list index out of range 
# 报错2解决:前面的“根据数据集修改文件”

常用ubuntu命令

unzip -oq /home/aistudio/work/mmdetection-2.3.0.zip #解压
cp -r dir1 dir2  # 复制
tar -vcf test.tar test # 压缩
vim filename #编辑:i ;退出编辑:exc ; 保存::wq

实验结果图

更多推荐

mmdetection的安装和训练、测试didi数据集的步骤(含结果)

本文发布于:2024-03-09 06:06:13,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1724099.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:步骤   测试   数据   mmdetection   didi

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!