华为云-AI开发平台ModelArts安装mmdetection步骤

简介: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)

  1. !pip install mmdet
  2. !pip install mmcv-full==1.3.3
  3. cd /home/ma-user/work/mmdetection-master/
  4. !pip install  -r requirements.txt
  5. !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)

测试效果

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值