ultralytics / ultralytics

Ultralytics YOLO11 🚀
https://docs.ultralytics.com
GNU Affero General Public License v3.0
31.9k stars 6.11k forks source link

I couldn't train even one image.... #1460

Closed sdimantsd closed 1 year ago

sdimantsd commented 1 year ago

Search before asking

Question

Hi all, I am try to train one image (overfit), but the results are very poor...

This is the ".txt" file:

0 0.065 0.058 0.014 0.006
0 0.136 0.0545 0.014 0.005
0 0.251 0.0285 0.016 0.007
0 0.8975 0.062 0.039 0.01
0 0.727 0.0725 0.036 0.011
0 0.3945 0.241 0.043 0.01
0 0.2045 0.248 0.037 0.012
0 0.0525 0.003 0.009 0.004

This is the YAML:

# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
path: /home/ws/data/dataset/apples/  # dataset root dir
train: train_overfit2.txt  # train images (relative to 'path') 128 images
val: train_overfit2.txt  # val images (relative to 'path') 128 images
test:  # test images (optional)

# Classes
nc: 1  # number of classes
names: ['apple']  # class names

this is the command: yolo train data=./data/apples_overfit.yaml model=./yolov8n.pt epochs=300 name=apples_overfit_yolov8n --imgsz=416 --cache hsv_h=0 hsv_s=0 hsv_v=0 degrees=0 translate=0 scale=0 shear=0 perspective=0 flipud=0 fliplr=0 mosaic=0

this is the "train_overfit2.txt":


/home/ws/data/dataset/apples/images/32425_1.jpg
/home/ws/data/dataset/apples/images/32425_1.jpg
/home/ws/data/dataset/apples/images/32425_1.jpg
/home/ws/data/dataset/apples/images/32425_1.jpg
...

(This line duplicate 128 times in train file)

A different train works well for me. Can someone help me please?

Additional

No response

glenn-jocher commented 1 year ago

@sdimantsd you might want to try using more than 1 image to train a YOLO model my friend.

sdimantsd commented 1 year ago

I try with 10K images. but it's not working. so I try one image to find the problem. It's might be because of small objects? When I change the height from 0.01 to 0.019 its works (0.01 on input size of 416 it's 4.16 pix, it's should be OK, right?)

glenn-jocher commented 1 year ago

@sdimantsd start from official datasets like COCO128 to get an idea of the results you should expect and then go from there:

yolo train data=coco128.yaml
sdimantsd commented 1 year ago

Hi, I know yolo from version 3. I know how to train it. I have problem with that specific dataset. and that image

github-actions[bot] commented 1 year ago

👋 Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help.

For additional resources and information, please see the links below:

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 YOLO 🚀 and Vision AI ⭐

pderrenger commented 11 months ago

Understood, @sdimantsd. When dealing with small objects, especially on a large input size like 416x416, improving the model's ability to detect such objects can be challenging. You might want to try different augmentation strategies like random cropping, mixup, or mosaic to help the model better generalize to small objects. Keep in mind that even with these techniques, smaller objects can still pose challenges for object detection models.