【问题标题】:Yolov5 seems to be training, but no weights are stored and no logs are shownYolov5 seems to be training, but no weights are stored and no logs are shown
【发布时间】:2022-12-28 09:26:21
【问题描述】:

I'm trying to run yolov5 model for roadsigns. I have 4 classes. And I have come so far:

Required packages are installed (it checks with requirement.txt)

  • Two yaml files are created and found
  • I run !python train.py --img 416 --batch 5 --epochs 3 --data new_data_yaml --cfg new_train_yaml
  • The computer is doing heavy calculating, which i can hear and see from my ram / cpu
  • No errors appear (If i change the train.py script with bugs it does get errors so it is definitely running)
  • After about one minute the cell has completed but without any output (of logs or prints)
  • In the folder runs/train/exp there are two yaml-files, one 0-file and one weights folder
  • But the weights folder is empty and does not have .pt files

I wonder where it goes wrong. Please help me.

This is the code that I run before executing train.py:

!pip install -r yolov5/requirements.txt  
%cd yolov5
import torch
print('Setup complete. Using torch %s %s' % (torch.__version__, torch.cuda.get_device_properties(0) if torch.cuda.is_available() else 'CPU'))
from IPython.display import Image
import pandas as pd
import random
import os
from shutil import copyfile
project = "RoadSignsPascalVOC"
with open(f'data/new_train_yaml', 'w+') as file:
    file.write(
        """
        # parameters
        nc: 4  # number of classes
        depth_multiple: 0.33  # model depth multiple
        width_multiple: 0.50  # layer channel multiple

        # anchors
        anchors:
          - [10,13, 16,30, 33,23]  # P3/8
          - [30,61, 62,45, 59,119]  # P4/16
          - [116,90, 156,198, 373,326]  # P5/32

        # YOLOv5 backbone
        backbone:
          # [from, number, module, args]
          [[-1, 1, Focus, [64, 3]],  # 0-P1/2
           [-1, 1, Conv, [128, 3, 2]],  # 1-P2/4
           [-1, 3, BottleneckCSP, [128]],
           [-1, 1, Conv, [256, 3, 2]],  # 3-P3/8
           [-1, 9, BottleneckCSP, [256]],
           [-1, 1, Conv, [512, 3, 2]],  # 5-P4/16
           [-1, 9, BottleneckCSP, [512]],
           [-1, 1, Conv, [1024, 3, 2]],  # 7-P5/32
           [-1, 1, SPP, [1024, [5, 9, 13]]],
           [-1, 3, BottleneckCSP, [1024, False]],  # 9
          ]

        # YOLOv5 head
        head:
          [[-1, 1, Conv, [512, 1, 1]],
           [-1, 1, nn.Upsample, [None, 2, 'nearest']],
           [[-1, 6], 1, Concat, [1]],  # cat backbone P4
           [-1, 3, BottleneckCSP, [512, False]],  # 13

           [-1, 1, Conv, [256, 1, 1]],
           [-1, 1, nn.Upsample, [None, 2, 'nearest']],
           [[-1, 4], 1, Concat, [1]],  # cat backbone P3
           [-1, 3, BottleneckCSP, [256, False]],  # 17 (P3/8-small)

           [-1, 1, Conv, [256, 3, 2]],
           [[-1, 14], 1, Concat, [1]],  # cat head P4
           [-1, 3, BottleneckCSP, [512, False]],  # 20 (P4/16-medium)

           [-1, 1, Conv, [512, 3, 2]],
           [[-1, 10], 1, Concat, [1]],  # cat head P5
           [-1, 3, BottleneckCSP, [1024, False]],  # 23 (P5/32-large)

           [[17, 20, 23], 1, Detect, [nc, anchors]],  # Detect(P3, P4, P5)
          ]
        """
    )
with open(f'data/new_data_yaml', 'w+') as file:
    file.write(
        f"""
        train: ../../Images/{project}/images
        val: ../../Images/{project}/images

        nc: 4
        names: ['Trafic Light', 'Stop', 'Speedlimit', 'Crosswalk']
        """
    )
%%time
os.chdir('C:/Users/ijmon/Documents/Notebooks/NN_zonder_import/yolov5')

【问题讨论】:

  • Please provide enough code so others can better understand or reproduce the problem.

标签: python torch yolo yolov5


【解决方案1】:

I have a same problem. Does anyone know how to solve it?

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-07-15
  • 2014-12-16
  • 2022-12-27
  • 2021-10-16
  • 2021-01-31
  • 1970-01-01
  • 2022-12-01
相关资源
最近更新 更多