简介:AI开发平台ModelArts是面向开发者的一站式AI开发平台,为机器学习与深度学习提供海量数据预处理及半自动化标注、大规模分布式Training、自动化模型生成,及端-边-云模型按需部署能力,帮助用户快速创建和部署模型,管理全周期AI工作流。
华为云中可以免费试用1小时的AI开发环境(包括cpu,GPU两种版本)
mmdetection安装步骤
一、环境部署
选择pytorch-1.4.0,python3的公共镜像
选择GPU模式(mmdetection训练时会用到GPU)
此环境下,配置为
Python 3.6.4;CUDA 10.1.243;pytorch 1.4.0 mmdetection版本:mmdetection-master;mmcv-full 1.3.3
版本兼容可查看https://github.com/open-mmlab/mmdetection(要注意兼容性,否则会出现各种奇葩问题)
二、mmdetection安装
创建开发环境(选择pytorch1.4.0)
- !pip install mmdet
- !pip install mmcv-full==1.3.3
- cd /home/ma-user/work/mmdetection-master/
- !pip install -r requirements.txt
- !pip install -v -e . (注意有个“.”)
上述5个步骤完成后,mmdetection安装完成
三、mmdetection测试
from mmdet.apis import init_detector, inference_detector,show_result_pyplot
import numpy as np
import os
import cv2
import random
import mmcv
config_file = 'configs/mask_rcnn/mask_rcnn_r50_caffe_fpn_mstrain-poly_3x_coco.py'
checkpoint_file = 'checkpoints/mask_rcnn_r50_caffe_fpn_mstrain-poly_3x_coco_bbox_mAP-0.408__segm_mAP-0.37_20200504_163245-42aa3d00.pth'
model = init_detector(config_file, checkpoint_file, device='cuda:0')
img = 'demo/demo.jpg'
result = inference_detector(model, img)
model.show_result(img, result)
model.show_result(img, result, out_file='demo/result.jpg')
show_result_pyplot(model, img, result)
测试效果