当前位置:网站首页>mmdetection的安装和训练、测试didi数据集的步骤(含结果)
mmdetection的安装和训练、测试didi数据集的步骤(含结果)
2022-08-11 05:35:00 【KPer_Yang】
目录
安装pytorch 1.3
conda create -n open-mmlab python=3.7 -y
conda init bash
conda activate open-mmlab
conda install pytorch=1.3.1 cudatoolkit=9.2 torchvision=0.4.2 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/linux-64/
安装mmcv
pip install mmcv-full==1.0.5 -f https://download.openmmlab.com/mmcv/dist/cu92/torch1.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+https://github.com/open-mmlab/cocoapi.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、手动下载 https://download.pytorch.org/models/resnet50-19c8e357.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
实验结果图
边栏推荐
猜你喜欢
随机推荐
HPC平台搭建
华为防火墙-3-应用过滤
类的定义、类的继承以及super的使用
查看CPU和其他硬件温度的软件
pytorch调整模型学习率
window7开启远程桌面功能
kill 命令
MySQL01
HCIP WPN实验
slurm集群搭建
SECURITY DAY04( Prometheus服务器 、 Prometheus被监控端 、 Grafana 、 监控数据库)
HCIP MGRE\OSPF Comprehensive Experiment
vnc远程桌面安装(2021-10-20日亲测可用)
uboot code analysis 1: find the main line according to the purpose
Especially the redis
Xshell如何连接虚拟机
CLUSTER DAY04(块存储应用案例 、 分布式文件系统 、 对象存储)
grep、sed、awk
iptables入门
SECURITY DAY06 ( iptables firewall, filter table control, extended matching, typical application of nat table)