modes/val/ #8153
Replies: 28 comments 85 replies
-
This line of code "metrics.box.map50" gives error saying that "'NoneType' object has no attribute 'box' ". My code is described below: Load a YOLOv8 modelmodel = YOLO('yolov8n.pt') Train the modelresults_train = model.train(data='japan5.yaml', epochs=1, imgsz=600) Validate the modelmetrics = model.val() # no arguments needed, dataset and settings remembered Please suggest. |
Beta Was this translation helpful? Give feedback.
-
i was trying to train my model but, i dont find de predict file after training either best.pt |
Beta Was this translation helpful? Give feedback.
-
After the training of YOLOv8, I got my metrics results in csv file. However, I did validation. But I cannot get my results in csv format. Only images (png & jpeg). How to get validation results in csv? |
Beta Was this translation helpful? Give feedback.
-
Hey, I am trying to get metrics such as recall and also trying to save some images in validation. I am using coco.yaml. Any idea how I might do it? |
Beta Was this translation helpful? Give feedback.
-
I want to get parameters of a class in metrics and save it to csv. Thank you very much. |
Beta Was this translation helpful? Give feedback.
-
hey i want to do the evaluate my model i already get the detection images using ignition gazebo and ros2 but now i want to evaluate my model like accuracy or MAP or recall how to do it i did not have any dataset or any annotations i am using pretrained yolov8 model and using coco8.yaml |
Beta Was this translation helpful? Give feedback.
-
Hello i have two questions. |
Beta Was this translation helpful? Give feedback.
-
Hello i have two questions kindly help me out. when i have custom trained model. if i load the model and then to detect use" !yolo detect val model=/weights/best.pt data=/data.yaml save=True save_json=True conf=0.85 iou=0.5 split=val " can i give it a new yaml file other than the one which model was trained. For example i used an old dataset to train the model. Now i have new data on which i want to validation of the model i upload data in valid folder and give its yaml file to the model to load those images and validate against the model. (THOSE ARE NEW IMAGES ADDED AFTER TRAINING IN VALID) will it give me accurate results on the new dataset against the model trained? I added 10k images to my Valid folder and want to detection on those new images and see the validation of the model. Second question is that does conf threshold matters while doing validation? and can you please explain how is the confusion matrix is build after validation because its prediction against classes so it goes and compares with the ground truth? Please explain thankyou |
Beta Was this translation helpful? Give feedback.
-
Hi, I want to use the validate function to finetune my trained model and see how it performs against real life pictures. There is however a difference in parameters available between "predict" mode and val "mode". For instance, I would like to use specific settings for Augment and retina_mask as part of the validation. Is this possible? And out of curiosity, why are the default settings for Val different from Predict? |
Beta Was this translation helpful? Give feedback.
-
Hi, I am completing a vision project for an automated industrial packing cell. Currently I have trained 3 custom models for the different tasks. I want to test the performance of each with different scenarios like bright, dim, natural, artificial lighting and varied backgrounds or similar objects. What would be the best method to do so? Would it be best to create these standard test datasets, link with yaml then use the val function? Or use predict and count correct / incorrect detections and work out metrics from there? Once I have done this I also want to investigate performance with different model architecture sizes and training times so has to be easily repeatable. How is best to implement basically, thanks in advance! |
Beta Was this translation helpful? Give feedback.
-
Hi, an iou (1) threshold is used during detection to prevent duplicate bounding boxes. |
Beta Was this translation helpful? Give feedback.
-
hi, the error is
|
Beta Was this translation helpful? Give feedback.
-
hi, |
Beta Was this translation helpful? Give feedback.
-
I use my own post-processing logic on the txts that i get from running inference the validation set. So now I have the post processed txts for the validation set and the original validation txts that i used for training. How to compute the val performance results using the txt files ? |
Beta Was this translation helpful? Give feedback.
-
When I use the command line: yolo task=detect mode=val model=best.pt data=data.yaml device=0 to verify, the results I get are very different from when I use default.yaml to verify. Why is this? |
Beta Was this translation helpful? Give feedback.
-
When we use model.val() for validation,It is found that the last output confusion_matrix_normalized.png confusion matrix has no number, that is, the relevant accuracy is printed. What is going on? |
Beta Was this translation helpful? Give feedback.
-
Hi! I am working with a dataset that includes only the 'car' class, where their corresponding label is '2' in my dataset. When I attempt to generate confusion matrix and other plots, I encounter a problem: the base model "yolov8n.pt" includes all the other classes while calculating the metrics. However, I want to use model.val( ) specifically for objects detected as a 'car'. Yaml file looks like this:
|
Beta Was this translation helpful? Give feedback.
-
Hi there! I'd like to get all visualisation results from all validation images. Then I try to run the following, but it only gives the first three batches, what should I do? model = YOLO('../best.pt') Thanks in advance! |
Beta Was this translation helpful? Give feedback.
-
hi, is it possible to integrate sahi during the verification process? To draw the corresponding evaluation curve on the high-resolution image |
Beta Was this translation helpful? Give feedback.
-
Why does this happen when I run val?Is my model based on yolov9e. Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Administrator\miniconda3\envs\yolo8\lib\multiprocessing\spawn.py", line 116, in spawn_main
exitcode = _main(fd, parent_sentinel)
File "C:\Users\Administrator\miniconda3\envs\yolo8\lib\multiprocessing\spawn.py", line 125, in _main
prepare(preparation_data)
File "C:\Users\Administrator\miniconda3\envs\yolo8\lib\multiprocessing\spawn.py", line 236, in prepare
_fixup_main_from_path(data['init_main_from_path'])
File "C:\Users\Administrator\miniconda3\envs\yolo8\lib\multiprocessing\spawn.py", line 287, in _fixup_main_from_path
main_content = runpy.run_path(main_path,
File "C:\Users\Administrator\miniconda3\envs\yolo8\lib\runpy.py", line 288, in run_path
return _run_module_code(code, init_globals, run_name,
File "C:\Users\Administrator\miniconda3\envs\yolo8\lib\runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "C:\Users\Administrator\miniconda3\envs\yolo8\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "c:\Users\Administrator\Desktop\yolov92\val.py", line 8, in <module>
metrics = model.val(
File "C:\Users\Administrator\miniconda3\envs\yolo8\lib\site-packages\ultralytics\engine\model.py", line 528, in val
validator(model=self.model)
File "C:\Users\Administrator\miniconda3\envs\yolo8\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "C:\Users\Administrator\miniconda3\envs\yolo8\lib\site-packages\ultralytics\engine\validator.py", line 154, in __call__
self.dataloader = self.dataloader or self.get_dataloader(self.data.get(self.args.split), self.args.batch)
File "C:\Users\Administrator\miniconda3\envs\yolo8\lib\site-packages\ultralytics\models\yolo\detect\val.py", line 226, in get_dataloader
return build_dataloader(dataset, batch_size, self.args.workers, shuffle=False, rank=-1) # return dataloader
File "C:\Users\Administrator\miniconda3\envs\yolo8\lib\site-packages\ultralytics\data\build.py", line 135, in build_dataloader
return InfiniteDataLoader(
File "C:\Users\Administrator\miniconda3\envs\yolo8\lib\site-packages\ultralytics\data\build.py", line 39, in __init__
self.iterator = super().__iter__()
File "C:\Users\Administrator\miniconda3\envs\yolo8\lib\site-packages\torch\utils\data\dataloader.py", line 439, in __iter__
return self._get_iterator()
File "C:\Users\Administrator\miniconda3\envs\yolo8\lib\site-packages\torch\utils\data\dataloader.py", line 387, in _get_iterator
return _MultiProcessingDataLoaderIter(self)
File "C:\Users\Administrator\miniconda3\envs\yolo8\lib\site-packages\torch\utils\data\dataloader.py", line 1040, in __init__
w.start()
File "C:\Users\Administrator\miniconda3\envs\yolo8\lib\multiprocessing\process.py", line 121, in start
self._popen = self._Popen(self)
File "C:\Users\Administrator\miniconda3\envs\yolo8\lib\multiprocessing\context.py", line 224, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "C:\Users\Administrator\miniconda3\envs\yolo8\lib\multiprocessing\context.py", line 327, in _Popen
return Popen(process_obj)
File "C:\Users\Administrator\miniconda3\envs\yolo8\lib\multiprocessing\popen_spawn_win32.py", line 45, in __init__
prep_data = spawn.get_preparation_data(process_obj._name)
File "C:\Users\Administrator\miniconda3\envs\yolo8\lib\multiprocessing\spawn.py", line 154, in get_preparation_data
_check_not_importing_main()
File "C:\Users\Administrator\miniconda3\envs\yolo8\lib\multiprocessing\spawn.py", line 134, in _check_not_importing_main
raise RuntimeError('''
RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.
This probably means that you are not using fork to start your
child processes and you have forgotten to use the proper idiom
in the main module:
if __name__ == '__main__':
freeze_support()
...
The "freeze_support()" line can be omitted if the program
is not going to be frozen to produce an executable. from ultralytics import YOLO
# Load a model
# model = YOLO('yolov8n.pt') # load an official model
model = YOLO(r"my\12\weights\best.pt") # load a custom model
# Validate the model
metrics = model.val(
data=r"my.yaml",
device=[0, 1, 2, 3, 4, 5],
split="test",
batch=16 * 6,
) cuda 12.4 windows11 torch-2.3.0
|
Beta Was this translation helpful? Give feedback.
-
Hi, |
Beta Was this translation helpful? Give feedback.
-
How can I output the value of F1 just like P and R, or simply print the value of F1 |
Beta Was this translation helpful? Give feedback.
-
why in the confusion matrix there is data that is considered background in the actual condition, not in the predicted condition. Even though in actual conditions the data has been given its respective label. |
Beta Was this translation helpful? Give feedback.
-
Hi! I'm evaluating a model with a custom dataset. I'm adjusting all the hyper-parameters until i get the best posible recall (because I'm more interested in detect objects more than the precision). |
Beta Was this translation helpful? Give feedback.
-
Hello! |
Beta Was this translation helpful? Give feedback.
-
modes/val/
Guide for Validating YOLOv8 Models. Learn how to evaluate the performance of your YOLO models using validation settings and metrics with Python and CLI examples.
https://docs.ultralytics.com/modes/val/
Beta Was this translation helpful? Give feedback.
All reactions