【存档】AutoDL复现FasterRcnn

mmdetection复现faster RCNN

镜像选择

PyTorch 1.5.1
Python 3.8(ubuntu18.04)
Cuda 10.1
RTX 2080 Ti(11GB) * 1

环境配置

source activate
conda create -n open-mmlab python=3.7
conda activate open-mmlab
  1. pytorch安装,版本选择: pytorch
conda install pytorch==1.5.1 torchvision==0.6.1 cudatoolkit=10.1 -c pytorch
  1. mmcv安装,根据cuda和torch版本选择命令:MMCV
python -c 'import torch;print(torch.__version__)'#查看torch和cuda版本
pip install mmcv==2.0.0rc4 -f https://download.openmmlab.com/mmcv/dist/cu117/torch1.13/index.html -i https://mirrors.aliyun.com/pypi/simple/
  1. mmdetection下载
git clone https://github.com/open-mmlab/mmdetection.git
cd mmdetection/
pip install -r requirements.txt
pip install mmdet
  1. 建立work_dirs文件夹,将预训练模型上传
    下载官方预训练模型

运行demo

  1. 方法一(命令试了好久,参考网上的命令怎么都不对,最后看了官方文档,发现是faster-rcnn和faster_rcnn的区别…我服了)
python demo/image_demo.py demo/demo.jpg configs/faster_rcnn/faster-rcnn_r101_fpn_1x_coco.py --weights preweights/faster_rcnn_r101_fpn_1x_coco_20200130-f513f705.pth --device cuda:0

检测结果在outputs文件夹中

  1. 方法二,新建py文件
from mmdet.apis import init_detector, inference_detector

config_file = 'configs/faster_rcnn/faster-rcnn_r101_fpn_1x_coco.py'
checkpoint_file = 'work_dirs/faster_rcnn_r101_fpn_1x_coco_20200130-f513f705.pth'
model = init_detector(config_file, checkpoint_file, device='cuda:0')  # or device='cuda:0'
inference_detector(model, 'demo/demo.jpg')

没找到检测结果在哪

一些问题

  1. checkpoints文件建立后打不开
    jupyter好像就是打不开,推测可能跟.ipynb_checkpoints隐藏文件有关
ls -a
rm -rf .ipynb_checkpoints
或rm -rf "find -type d -name .ipynb_checkpoints"

但还是没用,新建preweights文件夹存放预训练
2.

ValueError: Cannot find model: configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py in mmdet

image_demo.py: error: unrecognized arguments: checkpoints/faster_rcnn_r50_fpn

命令格式不对;py文件和预训练模型文件没有对应上

RuntimeError: unexpected EOF, expected 7219394 more bytes. The file might be corrupted.

预训练模型文件损坏,重新下载上传

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值