Giter Club home page Giter Club logo

Comments (35)

liyan1997 avatar liyan1997 commented on May 18, 2024 3

I encountered the same problem, but when I set the parameter “save_hybrid” to False, this issue is resolved.

from ultralytics.

VYRION-Ai avatar VYRION-Ai commented on May 18, 2024 1

i use 460 , i should use 480, thank you
that happened because in yolov5 it was correct automatically , sorry .

from ultralytics.

Caliphamin avatar Caliphamin commented on May 18, 2024 1

Pls send the code that you use to train
And also what do you want to do
I mean you working on instance segment or what

from ultralytics.

pderrenger avatar pderrenger commented on May 18, 2024 1

@aleehamza25 i'm glad to hear that setting the parameter "save_hybrid" to False resolved the issue for you! Sometimes small changes can have a big impact. If you have any more questions or need further assistance, feel free to ask!

from ultralytics.

VYRION-Ai avatar VYRION-Ai commented on May 18, 2024

when change the img size to 640 the code run correctly ? why?

from ultralytics.

Laughing-q avatar Laughing-q commented on May 18, 2024

@totoadel you have to make sure the img size can be divided by 32. That's the rule. :)

from ultralytics.

Robotatron avatar Robotatron commented on May 18, 2024

@totoadel you have to make sure the img size can be divided by 32. That's the rule. :)

It works with YOLOv5, it will automatically change the image size to be divisible by 32. I guess v8 doesnt do that?

from ultralytics.

Caliphamin avatar Caliphamin commented on May 18, 2024

@Laughing-q my image sizes are 1024x1024 but not working. i am facing this error

Sizes of tensors must match except in dimension 1. Expected size 57 but got size 0 for tensor number 1 in the list.
Sentry is attempting to send 1 pending error messages

i am using this command to run yolo instance segmentation
!yolo task=segment mode=train model=yolov8m-seg.pt data={dataset.location}/data.yaml epochs=100 imgsz=1024 batch=8
when i change image sizes or batch size the expected size in error changes to another number

from ultralytics.

Laughing-q avatar Laughing-q commented on May 18, 2024

@Caliphamin Training with your command but with coco128-seg.yaml works correctly to me.

yolo task=segment mode=train model=yolov8m-seg.pt data=coco128-seg.yaml epochs=100 imgsz=1024 batch=4

image

BTW I'm using the latest version of package.

from ultralytics.

Caliphamin avatar Caliphamin commented on May 18, 2024

@Laughing-q
I’ve changed my data format to yolov8

from ultralytics.

Caliphamin avatar Caliphamin commented on May 18, 2024

@Laughing-q
Can i send my data for you?
I’ve uploaded on roboflow

from ultralytics.

Laughing-q avatar Laughing-q commented on May 18, 2024

@Caliphamin sure, [email protected].

from ultralytics.

Laughing-q avatar Laughing-q commented on May 18, 2024

@Caliphamin I just checked your dataset, and found you were using a detection labels but trying to train a segmentation model which is incorrect. You should always train a segmentation model with segmentation labels.

BTW I just saw the following error when I was trying to reproduce your issue but it seems that you didn't encounter this error msg.
image
So I suppose that you might also need to upgrade the package pip install --upgrade ultralytics.

from ultralytics.

Caliphamin avatar Caliphamin commented on May 18, 2024

@Laughing-q ooooh, you mean my data is wrong. actually i did not get this message. i just thought my image sizes or batch sizes are wrong
thanks for helping me.
i am going to change my data and try it again.

from ultralytics.

Laughing-q avatar Laughing-q commented on May 18, 2024

@Caliphamin Also It's better to use the latest version of package. :)

from ultralytics.

Caliphamin avatar Caliphamin commented on May 18, 2024

I will do that too:)

from ultralytics.

AnonymousPhython avatar AnonymousPhython commented on May 18, 2024

@Laughing-q I am getting the same erroe can you check my dataset too..
Here is the link to the dataset: https://app.roboflow.com/btech-project/heavy-vehicle-detection-and-classification

from ultralytics.

Caliphamin avatar Caliphamin commented on May 18, 2024

@AnonymousPhython my problem solved by changing dataset label from object detection to instance segmentation
What is your dataset format?(i mean yolo, coco and etc)

from ultralytics.

AnonymousPhython avatar AnonymousPhython commented on May 18, 2024

@AnonymousPhython my problem solved by changing dataset label from object detection to instance segmentation What is your dataset format?(i mean yolo, coco and etc)

hi, it is YOLOv8 i am using yolov8n-seg.
you can take a look into my dataset at https://app.roboflow.com/btech-project/heavy-vehicle-detection-and-classification

from ultralytics.

AnonymousPhython avatar AnonymousPhython commented on May 18, 2024

thanks.. it is working now..

from ultralytics.

Caliphamin avatar Caliphamin commented on May 18, 2024

@AnonymousPhython What?how?😁

from ultralytics.

glenn-jocher avatar glenn-jocher commented on May 18, 2024

I apologize for any confusion. I am an AI language model and sometimes my responses might not make sense or be relevant to the conversation. Is there anything I can assist you with?

from ultralytics.

Kr-Sheshank avatar Kr-Sheshank commented on May 18, 2024

Screenshot from 2023-05-17 11-59-37

I got the same error, size of a tensor is not matched, even when I m using 416 and 640 image sizes.
Please help

from ultralytics.

VYRION-Ai avatar VYRION-Ai commented on May 18, 2024

@Kr-Sheshank it seems you are ruining training on local pc , if true, change batch=1

from ultralytics.

Kr-Sheshank avatar Kr-Sheshank commented on May 18, 2024

No i m running in google colab,
Screenshot from 2023-05-17 13-13-21

@Kr-Sheshank it seems you are ruining training on local pc , if true, change batch=1

from ultralytics.

Kr-Sheshank avatar Kr-Sheshank commented on May 18, 2024

@Caliphamin Training with your command but with coco128-seg.yaml works correctly to me.

yolo task=segment mode=train model=yolov8m-seg.pt data=coco128-seg.yaml epochs=100 imgsz=1024 batch=4

image

BTW I'm using the latest version of package.

I tried this it is working, training for coco data set is working but not for my dataset which I'm using from exporting from roboflow

from ultralytics.

VYRION-Ai avatar VYRION-Ai commented on May 18, 2024

@Kr-Sheshank write down your .yaml file here

from ultralytics.

Kr-Sheshank avatar Kr-Sheshank commented on May 18, 2024

@Kr-Sheshank write down your .yaml file here

names:

from ultralytics.

Kr-Sheshank avatar Kr-Sheshank commented on May 18, 2024

I think problem is with my dataset,I used another v8 segment data set from roboflow than training got start

from ultralytics.

glenn-jocher avatar glenn-jocher commented on May 18, 2024

@VYRION-Ai based on the error message you posted, it looks like the issue may be with your dataset. If you used another YOLOv8 segment dataset from Roboflow and the training started successfully, then it could be that your original dataset may have had issues with it. You may want to double check your original dataset to ensure that it's properly formatted and contains the necessary files and annotations in the correct format for YOLOv8 to work with.

from ultralytics.

CoffeeinTeaC avatar CoffeeinTeaC commented on May 18, 2024

@AnonymousPhython What?how?😁

@AnonymousPhython my problem solved by changing dataset label from object detection to instance segmentation What is your dataset format?(i mean yolo, coco and etc)

I encounter same problem.I guess something wrong in the process during json file convert to txt file.But I am not sure.Can you help me .

from ultralytics.

TheSole0 avatar TheSole0 commented on May 18, 2024

@glenn-jocher

I got the same above problems in Yolov8
My command is yolo detect train data=kitti.yaml model=yolov8s_test.yaml epochs=50 imgsz=640
this is my yaml file

`
backbone:
[from, repeats, module, args]

  • [-1, 1, Conv, [64, 3, 2]] # 0-P1/2
  • [-1, 1, Conv, [128, 3, 2]] # 1-P2/4
  • [-1, 3, C2f, [128, True]] # 2
  • [-1, 1, Conv, [256, 3, 2]] # 3-P3/8
  • [-1, 6, C2f, [256, True]] # 4
  • [-1, 1, Conv, [512, 3, 2]] # 5-P4/16
  • [-1, 6, C2f, [512, True]] # 6
  • [-1, 1, Conv, [768, 3, 2]] # 7-P5/32
  • [-1, 6, C2f, [768, True]] # 8
  • [-1, 1, Conv, [1024, 3, 2]] # 9-P6/64
  • [-1, 3, C2f, [1024, True]] # 10
  • [-1, 1, SPPF, [1024, 5]] # 11

head:

  • [-1, 1, nn.Upsample, [None, 2, 'nearest']] # 12

  • [[-1, 8], 1, Concat, [1]] # cat backbone P5 # 13

  • [-1, 3, C2f, [768]] # 14

  • [-1, 1, nn.Upsample, [None, 2, 'nearest']] # 15

  • [[-1, 6], 1, Concat, [1]] # cat backbone P4 # 16

  • [-1, 3, C2f, [512]] # (P4/16-medium) # 17

  • [-1, 1, Conv, [512, 3, 2]] # 18

  • [[-1, 14], 1, Concat, [1]] # cat head P3 # 19

  • [-1, 3, C2f, [768]] # (P5/32-large) # 20

  • [[17, 20], 1, Detect, [nc]] # Detect(P4, P5, P6) # 24
    `
    Actually, I want to use only medium and large heads that's why I did to scale up in backbone but it couldn't
    Why is this not working? Anybody can help me?

Image sizes 640 train, 640 val Using 8 dataloader workers Logging results to runs\detect\train11 Starting training for 50 epochs... Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size 1/50 3.25G 4.309 3.989 3.242 11 640: 100%|██████████| 335/335 [00:58<00:00 Class Images Instances Box(P R mAP50 mAP50-95): 0%| | 0/43 [00: Traceback (most recent call last): File "C:\Users\dlwlsgh\.conda\envs\yolov8\lib\runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "C:\Users\dlwlsgh\.conda\envs\yolov8\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\dlwlsgh\.conda\envs\yolov8\Scripts\yolo.exe\__main__.py", line 7, in <module> File "C:\Users\dlwlsgh\.conda\envs\yolov8\lib\site-packages\ultralytics\yolo\cfg\__init__.py", line 317, in entrypoint getattr(model, mode)(**overrides) # default args from model File "C:\Users\dlwlsgh\.conda\envs\yolov8\lib\site-packages\ultralytics\yolo\engine\model.py", line 325, in train self.trainer.train() File "C:\Users\dlwlsgh\.conda\envs\yolov8\lib\site-packages\ultralytics\yolo\engine\trainer.py", line 186, in train self._do_train(RANK, world_size) File "C:\Users\dlwlsgh\.conda\envs\yolov8\lib\site-packages\ultralytics\yolo\engine\trainer.py", line 357, in _do_train self.metrics, self.fitness = self.validate() File "C:\Users\dlwlsgh\.conda\envs\yolov8\lib\site-packages\ultralytics\yolo\engine\trainer.py", line 453, in validate metrics = self.validator(self) File "C:\Users\dlwlsgh\.conda\envs\yolov8\lib\site-packages\torch\autograd\grad_mode.py", line 26, in decorate_context return func(*args, **kwargs) File "C:\Users\dlwlsgh\.conda\envs\yolov8\lib\site-packages\ultralytics\yolo\engine\validator.py", line 159, in __call__ preds = model(batch['img']) File "C:\Users\dlwlsgh\.conda\envs\yolov8\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl result = self.forward(*input, **kwargs) File "C:\Users\dlwlsgh\.conda\envs\yolov8\lib\site-packages\ultralytics\nn\tasks.py", line 199, in forward return self._forward_once(x, profile, visualize) # single-scale inference, train File "C:\Users\dlwlsgh\.conda\envs\yolov8\lib\site-packages\ultralytics\nn\tasks.py", line 58, in _forward_once x = m(x) # run File "C:\Users\dlwlsgh\.conda\envs\yolov8\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl result = self.forward(*input, **kwargs) File "C:\Users\dlwlsgh\.conda\envs\yolov8\lib\site-packages\ultralytics\nn\modules.py", line 352, in forward return torch.cat(x, self.d) RuntimeError: Sizes of tensors must match except in dimension 2. Got 7 and 8 (The offending index is 0)

image

image

I already try to change stride 32 to 64 in "v5loader.py", "build.py" and "trainer.py"
Plz help me

from ultralytics.

aleehamza25 avatar aleehamza25 commented on May 18, 2024

I encountered the same problem, but when I set the parameter “save_hybrid” to False, this issue is resolved.

I was exhausted after wasting my whole day due to this parameter. You just saved my life

from ultralytics.

MandilJThapa avatar MandilJThapa commented on May 18, 2024

!yolo task=segment mode=train model=yolov8s-seg.pt data=dataset.yaml epochs=10 imgsz=320 batch= 4 save=true
Screenshot (132)
This problem arise when i am training custom data on yolov8 segmentation model

from ultralytics.

glenn-jocher avatar glenn-jocher commented on May 18, 2024

@MandilJThapa it looks like there might be an issue with the way the dataset or the model is configured. Could you please check if your dataset.yaml is correctly set up for segmentation tasks, and that the paths to images and labels are correct? Also, ensure that your model yolov8s-seg.pt is compatible with the segmentation task you're aiming at. If the problem persists, it could be helpful to share the dataset.yaml content and any error logs for more context.🙂

from ultralytics.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.