Heres a note for everyone, When training a model don't put any training data used for training the model to the validation data, because it can make your model overfit, means that your model will memorize the data instead of finding patterns and learning that. This results that model will accurately predict all the things in the training data but will suffer with new data!
Amazing tutorial! If anyone is having issues using a mobile GPU (Nvidia Quadro series etc) and finding that your losses are 0 in the output, use the amp=False flag on the yolo command.
This is great and thank you for providing it. I have used the SAM auto annotate segmentation function of YOLOv8 to annotate my image dataset of over 30,000 images with segmentation annotations, including train and val. (I already have a detection model trained on this dataset) It is still running but as soon as it is done I will test to see whether I can train the segmentation model from that data using this guide. Thanks again.
Update: the auto segmentation was good, but not great. I still have to go through and tighten up the boundaries. However on many images it has done a surprisingly good job. I have been through around 2000 images so far and I would say it's about 50/50 for images that don't need any rework. It wouldn't be possible to train an accurate segmentation model based on the raw output in my opinion.
@kaiserbala7419 have been working on another project since then, but i only got through fixing maybe 1/3 of the images. Hope to get back onto it in a few months or perhaps next year. The free segmentation apps are not all that good. I'll probably switch to using Matlab image annotator for the rest.
Best. Easy to understand. Do you have YOLOv8 video on Image classification? Or can you make one? For example if i have a fake and real mobile, how do i make classification model on it? Please guide. Thanks.
i want the format and structure of your dataset. i dont need your nature data. just the format and structure of data that you are training your data with. can you help me??
Thanks for your video! but it just converted about 20 pics (my dataset has about 800 pics and json annotation) when I running labelme2yolo. How to solve this problem?
When I run yours code after few second the sctipt ends with error code -11. Did you known what mean error "Process ended with exit code -11"? On source I was pi-camera and also checked with .jpg picture
command block says "your data is not for segmentation its detect data" or something like that. i guess its because labelme2yolo function returns us just txt and jpeg files. but segmentation needn json and png. also that txt file the function returned includes bounding box coordinates. its not for segmentation too. so it didnt work. you have an advice for me?
Use label studio instead. Check Yolov11 segmentation tutorial on my channel. It shows how to use it for annotations. th-cam.com/video/3LN23XJC28U/w-d-xo.html
Your videos are very helpful to me. Thank you very much. But I have a question for you, is there a way to check the fps? ? How to do it? ? Can you teach me?
Hello I have some query. I've followed your instructions on the vid I tried training multiple custom data of mine and I keep getting an error: WARNING no labels found in segment set, can not compute metrics without labels this is how I made my dataset DIR Train->images->class1,class2,class3 Labels->class1-> class1label.txt ,class2 - > class1label.txt ,class3 -> class1label.txt How do I tackle this problem? It would really help me If you answered my query thank you!
Hay, Your video is very informative. I have an issue with converting a single .json file to multiple json file according to the name of an image. Could please suggest me a way to do that
Does anyone know why my confidence score is very low (like 0.2) even though the segmentation is pretty accurate? I had to set conf=0.2 otherwise there would be no detection.
I get a KeyError 'shapes' when doing labelme2yolo, anyone knows how to solve this? My json files include coordinates of bounding boxes and polygons, so that is why the key ['shapes'] is included in there.
Hi, thanks for the tutorial! Although JSON annotation coordinates are within the original image size, running it through labelme2yolo converted some of the points to more than 1. As far as I know YOLO annotation coordinates should be located between 0 and 1( normalized). Because of this model training ignores 10% of dataset images. Have you ever had this issue? BTW I'm using another custom dataset. Seems like labelme2yolo is not working properly.
@@GamingCoderzX I use *labelImg* to annotate my images en yolo (txt) format. How can I use the program *labelMe* to annotate images. I would like to use circular and polygonal sections to annotate. Yolov8 and labelIma only permit rectangular sections.
I want to convert to tflite i got error (YoloV8) C:\Users\USER\anaconda3\envs\YoloV8\Gambar>yolo export model= yolov8m-seg.pt format=tflite Ultralytics YOLOv8.0.81 Python-3.10.10 torch-2.0.0+cu118 CPU YOLOv8m-seg summary (fused): 245 layers, 27268704 parameters, 0 gradients, 110.2 GFLOPs PyTorch: starting from yolov8m-seg.pt with input shape (1, 3, 640, 640) BCHW and output shape(s) ((1, 116, 8400), (1, 32, 160, 160)) (52.4 MB) TensorFlow SavedModel: starting export with tensorflow 2.12.0... ONNX: starting export with onnx 1.13.1 opset 17... ============= Diagnostic Run torch.onnx.export version 2.0.0+cu118 ============= verbose: False, log level: Level.ERROR ======================= 0 NONE 0 NOTE 0 WARNING 0 ERROR ======================== ONNX: simplifying with onnxsim 0.4.20... ONNX: simplifier failure: [ShapeInferenceError] (op_type:Gather, node name: /model.2/Gather): [TypeInferenceError] Inferred elem type differs from existing elem type: (FLOAT) vs (INT64) ONNX: export success 3.5s, saved as yolov8m-seg.onnx (104.3 MB) TensorFlow SavedModel: running 'onnx2tf -i yolov8m-seg.onnx -o yolov8m-seg_saved_model -nuo --non_verbose' ERROR: The trace log is below. Traceback (most recent call last): File "C:\Users\USER\anaconda3\envs\YoloV8\lib\site-packages\onnx2tf\utils\common_functions.py", line 281, in print_wrapper_func result = func(*args, **kwargs) File "C:\Users\USER\anaconda3\envs\YoloV8\lib\site-packages\onnx2tf\utils\common_functions.py", line 359, in inverted_operation_enable_disable_wrapper_func result = func(*args, **kwargs) File "C:\Users\USER\anaconda3\envs\YoloV8\lib\site-packages\onnx2tf\utils\common_functions.py", line 50, in get_replacement_parameter_wrapper_func func(*args, **kwargs) File "C:\Users\USER\anaconda3\envs\YoloV8\lib\site-packages\onnx2tf\ops\MaxPool.py", line 106, in make_node tf_pads = calc_tf_pooling_pads( File "C:\Users\USER\anaconda3\envs\YoloV8\lib\site-packages\onnx2tf\utils\common_functions.py", line 4011, in calc_tf_pooling_pads same_output_shape = math.floor((i - 1) / s) + 1 TypeError: unsupported operand type(s) for -: 'NoneType' and 'int' ERROR: input_onnx_file_path: yolov8m-seg.onnx ERROR: onnx_op_name: /model.9/m/MaxPool ERROR: Read this and deal with it. github.com/PINTO0309/onnx2tf#parameter-replacement ERROR: Alternatively, if the input OP has a dynamic dimension, use the -b or -ois option to rewrite it to a static shape and try again. ERROR: If the input OP of ONNX before conversion is NHWC or an irregular channel arrangement other than NCHW, use the -kt or -kat option. ERROR: Also, for models that include NonMaxSuppression in the post-processing, try the -onwdt option. TensorFlow SavedModel: export failure 9.6s: SavedModel file does not exist at: yolov8m-seg_saved_model\{saved_model.pbtxt|saved_model.pb} TensorFlow Lite: starting export with tensorflow 2.12.0... TensorFlow Lite: export success 0.0s, saved as yolov8m-seg_saved_model\yolov8m-seg_float32.tflite (0.0 MB) Export complete (11.3s) Results saved to C:\Users\USER\anaconda3\envs\YoloV8\Gambar Predict: yolo predict task=segment model=yolov8m-seg_saved_model\yolov8m-seg_float32.tflite imgsz=640 Validate: yolo val task=segment model=yolov8m-seg_saved_model\yolov8m-seg_float32.tflite imgsz=640 data=coco.yaml Visualize: netron.app
Hello. When start yolo task=segment mode=train epochs=15 data=dataset.yaml model=yolov8m-seg.pt imgsz=640 batch=1 part, I have this problem Closing dataloader mosaic Traceback (most recent call last): File "", line 1, in File "C:\Users\Rajaboff\anaconda3\envs\yolov8_segmentation\lib\multiprocessing\spawn.py", line 116, in spawn_main exitcode = _main(fd, parent_sentinel) File "C:\Users\Rajaboff\anaconda3\envs\yolov8_segmentation\lib\multiprocessing\spawn.py", line 126, in _main self = reduction.pickle.load(from_parent) File "C:\Users\Rajaboff\anaconda3\envs\yolov8_segmentation\lib\site-packages\torch\__init__.py", line 1537, in from .functional import * # noqa: F403 File "C:\Users\Rajaboff\anaconda3\envs\yolov8_segmentation\lib\site-packages\torch\functional.py", line 9, in import torch.nn.functional as F File "C:\Users\Rajaboff\anaconda3\envs\yolov8_segmentation\lib\site-packages\torch n\__init__.py", line 1, in from .modules import * # noqa: F403 File "C:\Users\Rajaboff\anaconda3\envs\yolov8_segmentation\lib\site-packages\torch n\modules\__init__.py", line 2, in from .linear import Identity, Linear, Bilinear, LazyLinear File "C:\Users\Rajaboff\anaconda3\envs\yolov8_segmentation\lib\site-packages\torch n\modules\linear.py", line 7, in from .. import functional as F File "C:\Users\Rajaboff\anaconda3\envs\yolov8_segmentation\lib\site-packages\torch n\functional.py", line 16, in from torch._torch_docs import reproducibility_notes, tf32_notes, sparse_support_notes File "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "", line 879, in exec_module File "", line 1012, in get_code File "", line 672, in _compile_bytecode MemoryError
im facing trouble when train the data (all my images is 100% corrupt they say?), is that problem is about labeling? train: Scanning /content/drive/MyDrive/Magang/TestYolo/Image/Train.cache... 82 images, 0 backgrounds, 82 corrupt: 100% 82/82 [00:00
Heres a note for everyone, When training a model don't put any training data used for training the model to the validation data, because it can make your model overfit, means that your model will memorize the data instead of finding patterns and learning that. This results that model will accurately predict all the things in the training data but will suffer with new data!
:), thanks for the heart
@@GamingCoderzX
Very useful advice.
Watching the videos 🎥 of this channel and reading the comments help me much
Amazing tutorial! If anyone is having issues using a mobile GPU (Nvidia Quadro series etc) and finding that your losses are 0 in the output, use the amp=False flag on the yolo command.
Thank you very much.
Glad I read your comment
Very well done, just went through the main topics fast and precise, without mentioning first class crap
Please check your messages
I love when you show it in the text editor
This is great and thank you for providing it. I have used the SAM auto annotate segmentation function of YOLOv8 to annotate my image dataset of over 30,000 images with segmentation annotations, including train and val. (I already have a detection model trained on this dataset) It is still running but as soon as it is done I will test to see whether I can train the segmentation model from that data using this guide. Thanks again.
Update: the auto segmentation was good, but not great. I still have to go through and tighten up the boundaries. However on many images it has done a surprisingly good job. I have been through around 2000 images so far and I would say it's about 50/50 for images that don't need any rework. It wouldn't be possible to train an accurate segmentation model based on the raw output in my opinion.
@@karlm9584 How's the result now?
@kaiserbala7419 have been working on another project since then, but i only got through fixing maybe 1/3 of the images. Hope to get back onto it in a few months or perhaps next year. The free segmentation apps are not all that good. I'll probably switch to using Matlab image annotator for the rest.
Thank you for explaining from start to end so seamlessly. So valuable content, surely will be using it for my vision project!
Glad it was helpful!
@@TheCodingBug
This channel rocks 💥.
How can I install *ultralytics* in the Python 🐍 console of the program Paraview.
Best regards.
Thanks Alot. I have one question. Which format is used to install model on jetson ?
Отличная работа! Спасибо за подробное видео!
I am glad it was helpful.
Best. Easy to understand. Do you have YOLOv8 video on Image classification? Or can you make one? For example if i have a fake and real mobile, how do i make classification model on it? Please guide. Thanks.
Great job! Thanks for the detailed video!
Glad you found it useful.
Thanks, man! It worked.
Thanks for the tutorial really clear. Is it possible to labelise multiple butterfly in one image during the labelisation process?
AMAZIIING TUTORIAAAAL !! pleaseeee, how to import that .onnx in unity? for object detection? Thaaaaanks
Thanks for this nice tutorial, (with useful details) . With which model of Nvidia GPU you got these results ?
I used GTX1060.
thanks so much, it is so clear and helpful
hello my friend
thank you so much
but i have a question
if i want to get the size (how many pixels) of the segmented object how can i do that ?
Thanks for the great video
i want the format and structure of your dataset. i dont need your nature data. just the format and structure of data that you are training your data with. can you help me??
What if my .json files after convertion to yolo .txt have random filename? Like "8a7309fbbd71edb9d8d5d45fea23a04f.txt". How to prevent this?
Thanks for your video!
but it just converted about 20 pics (my dataset has about 800 pics and json annotation) when I running labelme2yolo. How to solve this problem?
Can You please make a tutorial that how can we make our own model for polygon points training?
When I run yours code after few second the sctipt ends with error code -11. Did you known what mean error "Process ended with exit code -11"? On source I was pi-camera and also checked with .jpg picture
The manual work for labelme is very long. Is there an automatic or semi-auto way of doing that?
How can I detect the object in code and act on it? For example if a butterfly is detected print something to the console. Thanks!
Sir , i need to extract the instance mask can you pls suggest something, it would be a great help?
What If I have to count the object in this particular ?
command block says "your data is not for segmentation its detect data" or something like that. i guess its because labelme2yolo function returns us just txt and jpeg files. but segmentation needn json and png. also that txt file the function returned includes bounding box coordinates. its not for segmentation too. so it didnt work. you have an advice for me?
Use label studio instead. Check Yolov11 segmentation tutorial on my channel. It shows how to use it for annotations. th-cam.com/video/3LN23XJC28U/w-d-xo.html
@@TheCodingBug thanks! I will try it and then im gonna write here if it is works or not
@@TheCodingBug it worked, thanks!
hi thanks for the vedio it was full of information, my question is how can do this trianing using Google Colab , since i don't have a laptop with GPU
the same question I was about asking
@@sijitek
You don’t need the a computer with GPU. You can do it with the normal CPU, it will be slower but it will work.
If all the json is in one file. How to convert to text for each image. Please refer to some tutorial or code. Will be very thankful.
Best Regards
Your videos are very helpful to me. Thank you very much.
But I have a question for you, is there a way to check the fps? ?
How to do it? ? Can you teach me?
Yes. I'll upload a video this week.
@@TheCodingBug still waiting
On conda prompt there is error occurred "yolo is not recognised as an internal or external command"
Why?
You need to install ultralytics.
is this will work for face recognition instead identification?
Hello I have some query. I've followed your instructions on the vid I tried training multiple custom data of mine and I keep getting an error: WARNING no labels found in segment set, can not compute metrics without labels
this is how I made my dataset DIR
Train->images->class1,class2,class3
Labels->class1-> class1label.txt ,class2 - > class1label.txt ,class3 -> class1label.txt
How do I tackle this problem?
It would really help me If you answered my query thank you!
nice work!!, can this been set up for soccer game stats?
How I can use my 8gb GPU if I have AMD radeon rx580 on Windows 10? Please answer asap i will very appreciate it
Hay,
Your video is very informative. I have an issue with converting a single .json file to multiple json file according to the name of an image. Could please suggest me a way to do that
You can give single json file as input to the command that converts annotations to yolo format.
Does anyone know why my confidence score is very low (like 0.2) even though the segmentation is pretty accurate? I had to set conf=0.2 otherwise there would be no detection.
I get a KeyError 'shapes' when doing labelme2yolo, anyone knows how to solve this? My json files include coordinates of bounding boxes and polygons, so that is why the key ['shapes'] is included in there.
that is because your json file is not in the LabelMe json format.
Great Job
Hi, thanks for the tutorial!
Although JSON annotation coordinates are within the original image size, running it through labelme2yolo converted some of the points to more than 1. As far as I know YOLO annotation coordinates should be located between 0 and 1( normalized). Because of this model training ignores 10% of dataset images. Have you ever had this issue? BTW I'm using another custom dataset. Seems like labelme2yolo is not working properly.
No. I never had such an issue!
yeah im facing the trouble says: ignoring corrupt image/label: Label class 2 exceeds dataset class count 1. Possible class labels are 0-0
Seems like your problem where you didn't label the data properly
@@GamingCoderzX
I use *labelImg* to annotate my images en yolo (txt) format.
How can I use the program *labelMe* to annotate images. I would like to use circular and polygonal sections to annotate.
Yolov8 and labelIma only permit rectangular sections.
I want to convert to tflite i got error
(YoloV8) C:\Users\USER\anaconda3\envs\YoloV8\Gambar>yolo export model= yolov8m-seg.pt format=tflite
Ultralytics YOLOv8.0.81 Python-3.10.10 torch-2.0.0+cu118 CPU
YOLOv8m-seg summary (fused): 245 layers, 27268704 parameters, 0 gradients, 110.2 GFLOPs
PyTorch: starting from yolov8m-seg.pt with input shape (1, 3, 640, 640) BCHW and output shape(s) ((1, 116, 8400), (1, 32, 160, 160)) (52.4 MB)
TensorFlow SavedModel: starting export with tensorflow 2.12.0...
ONNX: starting export with onnx 1.13.1 opset 17...
============= Diagnostic Run torch.onnx.export version 2.0.0+cu118 =============
verbose: False, log level: Level.ERROR
======================= 0 NONE 0 NOTE 0 WARNING 0 ERROR ========================
ONNX: simplifying with onnxsim 0.4.20...
ONNX: simplifier failure: [ShapeInferenceError] (op_type:Gather, node name: /model.2/Gather): [TypeInferenceError] Inferred elem type differs from existing elem type: (FLOAT) vs (INT64)
ONNX: export success 3.5s, saved as yolov8m-seg.onnx (104.3 MB)
TensorFlow SavedModel: running 'onnx2tf -i yolov8m-seg.onnx -o yolov8m-seg_saved_model -nuo --non_verbose'
ERROR: The trace log is below.
Traceback (most recent call last):
File "C:\Users\USER\anaconda3\envs\YoloV8\lib\site-packages\onnx2tf\utils\common_functions.py", line 281, in print_wrapper_func
result = func(*args, **kwargs)
File "C:\Users\USER\anaconda3\envs\YoloV8\lib\site-packages\onnx2tf\utils\common_functions.py", line 359, in inverted_operation_enable_disable_wrapper_func
result = func(*args, **kwargs)
File "C:\Users\USER\anaconda3\envs\YoloV8\lib\site-packages\onnx2tf\utils\common_functions.py", line 50, in get_replacement_parameter_wrapper_func
func(*args, **kwargs)
File "C:\Users\USER\anaconda3\envs\YoloV8\lib\site-packages\onnx2tf\ops\MaxPool.py", line 106, in make_node
tf_pads = calc_tf_pooling_pads(
File "C:\Users\USER\anaconda3\envs\YoloV8\lib\site-packages\onnx2tf\utils\common_functions.py", line 4011, in calc_tf_pooling_pads
same_output_shape = math.floor((i - 1) / s) + 1
TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'
ERROR: input_onnx_file_path: yolov8m-seg.onnx
ERROR: onnx_op_name: /model.9/m/MaxPool
ERROR: Read this and deal with it. github.com/PINTO0309/onnx2tf#parameter-replacement
ERROR: Alternatively, if the input OP has a dynamic dimension, use the -b or -ois option to rewrite it to a static shape and try again.
ERROR: If the input OP of ONNX before conversion is NHWC or an irregular channel arrangement other than NCHW, use the -kt or -kat option.
ERROR: Also, for models that include NonMaxSuppression in the post-processing, try the -onwdt option.
TensorFlow SavedModel: export failure 9.6s: SavedModel file does not exist at: yolov8m-seg_saved_model\{saved_model.pbtxt|saved_model.pb}
TensorFlow Lite: starting export with tensorflow 2.12.0...
TensorFlow Lite: export success 0.0s, saved as yolov8m-seg_saved_model\yolov8m-seg_float32.tflite (0.0 MB)
Export complete (11.3s)
Results saved to C:\Users\USER\anaconda3\envs\YoloV8\Gambar
Predict: yolo predict task=segment model=yolov8m-seg_saved_model\yolov8m-seg_float32.tflite imgsz=640
Validate: yolo val task=segment model=yolov8m-seg_saved_model\yolov8m-seg_float32.tflite imgsz=640 data=coco.yaml
Visualize: netron.app
Why would you do segmentation over object detection?
how do you extract the confidence values shown above bounding box
where is the second label?
How can I use this model in my code? I want to save points coordinates to list.
Hello. When start yolo task=segment mode=train epochs=15 data=dataset.yaml model=yolov8m-seg.pt imgsz=640 batch=1 part, I have this problem
Closing dataloader mosaic
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\Rajaboff\anaconda3\envs\yolov8_segmentation\lib\multiprocessing\spawn.py", line 116, in spawn_main
exitcode = _main(fd, parent_sentinel)
File "C:\Users\Rajaboff\anaconda3\envs\yolov8_segmentation\lib\multiprocessing\spawn.py", line 126, in _main
self = reduction.pickle.load(from_parent)
File "C:\Users\Rajaboff\anaconda3\envs\yolov8_segmentation\lib\site-packages\torch\__init__.py", line 1537, in
from .functional import * # noqa: F403
File "C:\Users\Rajaboff\anaconda3\envs\yolov8_segmentation\lib\site-packages\torch\functional.py", line 9, in
import torch.nn.functional as F
File "C:\Users\Rajaboff\anaconda3\envs\yolov8_segmentation\lib\site-packages\torch
n\__init__.py", line 1, in
from .modules import * # noqa: F403
File "C:\Users\Rajaboff\anaconda3\envs\yolov8_segmentation\lib\site-packages\torch
n\modules\__init__.py", line 2, in
from .linear import Identity, Linear, Bilinear, LazyLinear
File "C:\Users\Rajaboff\anaconda3\envs\yolov8_segmentation\lib\site-packages\torch
n\modules\linear.py", line 7, in
from .. import functional as F
File "C:\Users\Rajaboff\anaconda3\envs\yolov8_segmentation\lib\site-packages\torch
n\functional.py", line 16, in
from torch._torch_docs import reproducibility_notes, tf32_notes, sparse_support_notes
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "", line 879, in exec_module
File "", line 1012, in get_code
File "", line 672, in _compile_bytecode
MemoryError
can I do field boundary delineation?
concise
Without GPU can i do the whole thing with 10-20 images?
Yes.
Hey, this is not instance segmentation it is semantic segmentation. Here all your butterfly classes have same id.
Class Images Instances Box(P R mAP50 mAP50-95) Mask(P R mAP50 mAP50-95): 100%|██████████| 1/1 [00:11
Dataset is too small... Or use any other model (other than tiny, maybe use medium version)
Pls help me to sort out this issue
How to export it to android app
おばあさんも前見えてないんちゃうん?
The thing is ML is becoming a blackbox for everyone using it!!! and that is not good need to say
im facing trouble when train the data (all my images is 100% corrupt they say?), is that problem is about labeling?
train: Scanning /content/drive/MyDrive/Magang/TestYolo/Image/Train.cache... 82 images, 0 backgrounds, 82 corrupt: 100% 82/82 [00:00
Yes, your problem is with the labelling tasks