Closed chenjunson closed 4 years ago
可以使用预训练模型的,你在指令里面加上pt就可以了
加上- pt后报错如下: chenjunsong@chenjunsong-GJ5CN64:~/U-YOLOv3$ python3 train.py --data data/obj.data --batch-size 5 --cfg cfg/yolov3-mobilenet/yolov3-mobilenet.cfg --weights weights/yolov3-mobilenet.weights -pt Apex recommended for faster mixed precision training: https://github.com/NVIDIA/apex Namespace(KDstr=-1, adam=False, batch_size=5, bucket='', cache_images=False, cfg='./cfg/yolov3-mobilenet/yolov3-mobilenet.cfg', data='data/obj.data', device='', ema=False, epochs=601, evolve=False, img_size=[320, 640], multi_scale=False, name='', nosave=False, notest=False, prune=-1, pt=True, qlayers=-1, quantized=-1, rect=False, resume=False, s=0.001, single_cls=False, sr=False, t_cfg='', t_weights='', weights='weights/yolov3-mobilenet.weights') Using CUDA device0 _CudaDeviceProperties(name='GeForce GTX 1060', total_memory=6072MB)
Start Tensorboard with "tensorboard --logdir=runs", view at http://localhost:6006/
Model Summary: 229 layers, 2.37856e+07 parameters, 2.37856e+07 gradients
Optimizer groups: 70 .bias, 55 Conv2d.weight, 104 other
Traceback (most recent call last):
File "train.py", line 523, in
我把yolov3-mobilenet.weights改为yolov3-mobilenet.pt错误就变成这样了:chenjunsong@chenjunsong-GJ5CN64:~/U-YOLOv3$ python3 train.py --data data/obj.data --batch-size 5 --cfg cfg/yolov3-mobilenet/yolov3-mobilenet.cfg --weights weights/yolov3-mobilenet.pt -pt Apex recommended for faster mixed precision training: https://github.com/NVIDIA/apex Namespace(KDstr=-1, adam=False, batch_size=5, bucket='', cache_images=False, cfg='./cfg/yolov3-mobilenet/yolov3-mobilenet.cfg', data='data/obj.data', device='', ema=False, epochs=601, evolve=False, img_size=[320, 640], multi_scale=False, name='', nosave=False, notest=False, prune=-1, pt=True, qlayers=-1, quantized=-1, rect=False, resume=False, s=0.001, single_cls=False, sr=False, t_cfg='', t_weights='', weights='weights/yolov3-mobilenet.pt') Using CUDA device0 _CudaDeviceProperties(name='GeForce GTX 1060', total_memory=6072MB)
Start Tensorboard with "tensorboard --logdir=runs", view at http://localhost:6006/
Model Summary: 229 layers, 2.37856e+07 parameters, 2.37856e+07 gradients
Optimizer groups: 70 .bias, 55 Conv2d.weight, 104 other
Traceback (most recent call last):
File "train.py", line 523, in
似乎注释掉assert ptr == len(weights)这行命令就能训练了。但注释掉这行后训练,算是加载了预训练模型,还是没有呢?
--cfg cfg/yolov3-mobilenet/yolov3-mobilenet.cfg 这块,你的cfg文件需要重写一下,你可以参照我的不同数据集上的cfg文件,更改类别,yolo层前的一层卷积的通道数,重写一个cfg文件再训练就可以了
那个cfg文件我改过了,类别改得1,那个yolo层前的一层卷积的通道数改成了18。你说的是要改这两个部分吧,三处的yolo层都改过了。 [convolutional] size=1 stride=1 pad=1 filters=18 activation=linear
[yolo] mask = 6,7,8 anchors = 10,13, 16,30, 33,23, 30,61, 62,45, 59,119, 116,90, 156,198, 373,326 classes=1 num=9 jitter=.3 ignore_thresh = .7 truth_thresh = 1 random=1
我用你项目里面带的那个yolov3-mobilenet-hand.cfg也是只有一类目标,可以对我的数据集进行训练,可能是我的那个cfg文件那块有问题,我去对比找找看,非常感谢。
如果是单分类你可以用hand的那个,不过建议你最好重新聚类一下anchor
嗯,是的,我去重新聚类一下anchor。
我只有一类目标,可以用你在项目中给出的coco的80类的yolov3-mobilenet.weights预训练模型吗?我用这个预训练模型会报错,是需要改一下什么地方吗?