cpu win10 安装yolo_yolov5 win10 数据集制作 各种踩坑

1.GitHub 下载yolov5

2.环境:win10,visual studio 2015 ,anaconda2.7,python=3.7,cuda=10.2 ,pytorch=1.5(GPU)

3.更改镜像-清华

4.安装pytorch

5.安装requirements.txt:报错。解决方案:

git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI

用这个替换掉原有语句

6.下载预训练模型,YOLOv5l.pt。

7.直接运行detect文件,报错。解决方案:

1.python detect.py --source ./inference/images/bus.jpg --weights ./weights/yolov5s.pt --conf 0.4 --device cuda:0

2.这里报错:找不到cuda

3.进入到torch_utils.py,

def select_device(device='', apex=False, batch_size=None):

# device = 'cpu' or '0' or '0,1,2,3'

cpu_request = device.lower() == 'cpu'

if device and not cpu_request: # if device requested other than 'cpu'

os.environ['CUDA_VISIBLE_DEVICES'] = device # set environment variable

assert torch.cuda.is_available(), 'CUDA unavailable, invalid device %s requested' % device # check availablity

.

.

.

加入一个语句

def select_device(device='', apex=False, batch_size=None):

# device = 'cpu' or '0' or '0,1,2,3'

print(torch.cuda.is_available())

cpu_request = device.lower() == 'cpu'

if device and not cpu_request: # if device requested other than 'cpu'

os.environ['CUDA_VISIBLE_DEVICES'] = device # set environment variable

assert torch.cuda.is_available(), 'CUDA unavailable, invalid device %s requested' % device # check availablity

这样就可以找到cuda

于是得到结果:

接下来,是制作自己的小型数据集,训练和测试

0.下载coco2017,手动选40张图片和对应标签。

1.目录结构:

##数据集和代码平行目录

yolo的格式是 xxx.jpg和对应的 xxx.txt,共2个文件

txt中存放的是标注好的人、狗、摩托车的坐标;还有所属类别的序号

2.自制yaml文件

train: ../lee/train/images

val: ../lee/valid/images

test: ../lee/test/images

# number of classes

nc: 80

# class names

names: ['person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'train', 'truck', 'boat', 'traffic light',

'fire hydrant', 'stop sign', 'parking meter', 'bench', 'bird', 'cat', 'dog', 

  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值