ultralytics / yolov3

YOLOv3 in PyTorch > ONNX > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
10.22k stars 3.45k forks source link

RuntimeError: shape '[4, 3, 10, 16, 16]' is invalid for input of size 261120 #1395

Closed OmkarShidore closed 4 years ago

OmkarShidore commented 4 years ago

❔Question

Additional context

github-actions[bot] commented 4 years ago

Hello @OmkarShidore, thank you for your interest in our work! Ultralytics has open-sourced YOLOv5 at https://github.com/ultralytics/yolov5, featuring faster, lighter and more accurate object detection. YOLOv5 is recommended for all new projects.

To continue with this repo, please visit our Custom Training Tutorial to get started, and see our Google Colab Notebook, Docker Image, and GCP Quickstart Guide for example environments.

If this is a bug report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.

If this is a custom model or data training question, please note that Ultralytics does not provide free personal support. As a leader in vision ML and AI, we do offer professional consulting, from simple expert advice up to delivery of fully customized, end-to-end production solutions for our clients, such as:

For more information please visit https://www.ultralytics.com.

OmkarShidore commented 4 years ago

open yolov3-spp.cfg,calculate and change features = 255 to [5+n]*3 where n= no. of classes in your problem statement, for coco it's 80 classes, hence default feature= 255, also change the classes=80 to your no. of class in in 3 YOLO layers. explained clearly on 5th point on this page https://docs.ultralytics.com/yolov5/tutorials/train_custom_data

glenn-jocher commented 1 year ago

@OmkarShidore thanks for reaching out! The adjustment you've mentioned is in fact specific to YOLOv5 and doesn't directly apply to YOLOv3. However, for YOLOv3, you can modify the configuration file to set the number of classes in the [yolo] layers to the desired number.

You can locate the [yolo] layers and modify the "classes" parameter to match the number of classes in your specific use case. Additionally, make sure to adjust the "filters" parameter in the [convolutional] layer preceding each [yolo] layer based on the formula: filters = (classes + 5) * 3.

Feel free to refer to the YOLOv3 documentation for more detailed information on how to customize the configuration for your specific needs. Let me know if you need further assistance!