ultralytics / yolov5

YOLOv5 πŸš€ in PyTorch > ONNX > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
49.83k stars 16.13k forks source link

Grayscale images #4894

Closed AlexisPapaioannou closed 2 years ago

AlexisPapaioannou commented 3 years ago

❔Question

Hello,

When I used the Yolov5 with gray scale images I received the below error. I had also added a parameter ch: 1 into the yaml file.

Additional context

Given groups=1, weight of size [8, 1, 3, 3], expected input[16, 3, 128, 128] to have 1 channels, but got 3 channels instead

The custom yaml file

parameters

nc: {num_classes} # number of classes ch: 1 # input channels depth_multiple: 0.33 # model depth multiple width_multiple: 0.35 # layer channel multiple

anchors

anchors:

YOLOv5 backbone

[from, number, module, args] # kernel, padding, stride

backbone:

[from, number, module, args]

[[-1, 1, Conv, [16, 3, 2]], # 0-P1/2 [-1, 1, Conv, [8, 3, 2]], # 1-P2/4 [-1, 1, Conv, [32, 3, 2]], # 1-P2/4 [-1, 3, C3, [32]], [-1, 1, Conv, [32, 3, 2]], # 3-P3/8 [-1, 9, C3, [64]], [-1, 1, Conv, [64, 3, 2]], # 5-P4/16 [-1, 9, C3, [128]], [-1, 1, Conv, [128, 3, 2]], # 7-P5/32 [-1, 1, SPP, [256, [5, 9, 13]]], [-1, 3, C3, [128, False]], # 9 ]

glenn-jocher commented 2 years ago

@AlexisPapaioannou no modifications to anything are required to train greyscale.

github-actions[bot] commented 2 years ago

πŸ‘‹ Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs.

Access additional YOLOv5 πŸš€ resources:

Access additional Ultralytics ⚑ resources:

Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!

Thank you for your contributions to YOLOv5 πŸš€ and Vision AI ⭐!