Unai Gurbindo 
							
						 
					 
					
						
						
							
							
						
						
						
							
						
						
							a974079bd5 
							
						 
					 
					
						
						
							
							Update metrics.py  
						
						 
						
						... 
						
						
						
						## Possible error in the `ap_per_class` function when calculating the precision-recall curve
Hello,
I have identified a possible error in the `ap_per_class` function when calculating the metrics for the precision-recall curve. Below, I provide an example to explain it more clearly:
Let’s assume the `unique_classes` list is `[0, 1, 2]`, and the model never predicted class 1. In this case, on line 583 of the `utils/metrics.py` file, the loop will skip to the next class (class 2) because `n_p == 0` for class 1. 
However, before moving on to the next class, a zero-filled array corresponding to class 1 should be added to the `prec_values` list. Otherwise, the precision-recall curve for class 2 will incorrectly appear as if it belongs to class 1, and the legend will also fail to show the correct label for class 2.
To fix this behavior, before the `continue` statement, the code should be modified as follows:
```python
if n_p == 0 or n_l == 0:
    prec_values.append(np.zeros(1000))
    continue
```
I hope my explanation is clear, and I have correctly identified the issue. While this is a rare case where the model never predicts one of the classes in the dataset, it is still something to consider to avoid errors in the precision-recall curve visualizations.
Best regards. 
						
						
					 
					
						2024-10-08 12:32:30 +02:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								inisis 
							
						 
					 
					
						
						
							
							
						
						
						
							
						
						
							cd2f79c702 
							
						 
					 
					
						
						
							
							fix onnxslim version ( #380 )  
						
						 
						
						
						
						
					 
					
						2024-07-30 15:16:55 +08:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								leonnil 
							
						 
					 
					
						
						
						
						
							
						
						
							0e51495ce6 
							
						 
					 
					
						
						
							
							replace onnxsim with onnxslim  
						
						 
						
						
						
						
					 
					
						2024-07-30 04:34:28 +00:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								leonnil 
							
						 
					 
					
						
						
						
						
							
						
						
							aad320dd80 
							
						 
					 
					
						
						
							
							prediction augment (TTA) fix ( #288 )  
						
						 
						
						
						
						
					 
					
						2024-06-23 08:21:40 +00:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								leonnil 
							
						 
					 
					
						
						
						
						
							
						
						
							2c36ab0f10 
							
						 
					 
					
						
						
							
							ddp resume checkpoint fix ( #184 )  
						
						 
						
						
						
						
					 
					
						2024-06-15 16:22:32 +00:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								shiraha721 
							
						 
					 
					
						
						
							
							
						
						
						
							
						
						
							3a53d91ec8 
							
						 
					 
					
						
						
							
							fix cv2.error when use PIL.Image.Image ( #241 )  
						
						 
						
						
						
						
					 
					
						2024-06-11 21:55:42 +08:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								wa22 
							
						 
					 
					
						
						
						
						
							
						
						
							ea93d4f379 
							
						 
					 
					
						
						
							
							update huggingface hub card template  
						
						 
						
						
						
						
					 
					
						2024-06-07 16:22:42 +08:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								wa22 
							
						 
					 
					
						
						
						
						
							
						
						
							e161d70ff7 
							
						 
					 
					
						
						
							
							update huggingface hub card template  
						
						 
						
						
						
						
					 
					
						2024-06-07 16:19:04 +08:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								Pbatch 
							
						 
					 
					
						
						
							
							
						
						
						
							
						
						
							d8777c1449 
							
						 
					 
					
						
						
							
							Make postprocessing compatible with nobuco ( #204 )  
						
						 
						
						
						
						
					 
					
						2024-06-06 07:57:59 +08:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								kangsanha 
							
						 
					 
					
						
						
							
							
						
						
						
							
						
						
							e6d80f3fa6 
							
						 
					 
					
						
						
							
							Update __init__.py ( #191 )  
						
						 
						
						... 
						
						
						
						/Desktop/ultralytics/runs/detect/ -> /Desktop/yolov10/runs/detect/ 
						
						
					 
					
						2024-06-04 19:19:53 +08:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								kangsanha 
							
						 
					 
					
						
						
							
							
						
						
						
							
						
						
							15bdea757a 
							
						 
					 
					
						
						
							
							fix onnx model val.py AssertionError  ( #190 )  
						
						 
						
						
						
						
					 
					
						2024-06-04 19:18:04 +08:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								leonnil 
							
						 
					 
					
						
						
						
						
							
						
						
							ba0e6cbc1a 
							
						 
					 
					
						
						
							
							fix onnx validation ( #179 )  
						
						 
						
						
						
						
					 
					
						2024-06-04 10:29:21 +00:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								wa22 
							
						 
					 
					
						
						
						
						
							
						
						
							e5f2f03c55 
							
						 
					 
					
						
						
							
							use yolov10 by default in cli  
						
						 
						
						
						
						
					 
					
						2024-06-04 11:06:48 +08:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								wa22 
							
						 
					 
					
						
						
						
						
							
						
						
							dfed201384 
							
						 
					 
					
						
						
							
							add support for HuggingFace Hub for cli  
						
						 
						
						
						
						
					 
					
						2024-06-03 23:04:27 +08:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								Ekaterina Aidova 
							
						 
					 
					
						
						
							
							
						
						
						
							
						
						
							060af8b8c1 
							
						 
					 
					
						
						
							
							Small fix in detection head for enabling ov export from scratch ( #183 )  
						
						 
						
						
						
						
					 
					
						2024-06-03 17:59:44 +08:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								wa22 
							
						 
					 
					
						
						
						
						
							
						
						
							1539b5a678 
							
						 
					 
					
						
						
							
							add calculation for flops  
						
						 
						
						
						
						
					 
					
						2024-06-03 11:21:49 +08:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								NielsRogge 
							
						 
					 
					
						
						
							
							
						
						
						
							
						
						
							a6e064d331 
							
						 
					 
					
						
						
							
							Track downloads ( #172 )  
						
						 
						
						... 
						
						
						
						Track downloads from the HuggingFace hub 
						
						
					 
					
						2024-06-03 10:23:37 +08:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								wa22 
							
						 
					 
					
						
						
						
						
							
						
						
							7a0cce17b6 
							
						 
					 
					
						
						
							
							add names when pushing to huggingface hub  
						
						 
						
						
						
						
					 
					
						2024-06-03 10:21:43 +08:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								NielsRogge 
							
						 
					 
					
						
						
							
							
						
						
						
							
						
						
							989cdb812d 
							
						 
					 
					
						
						
							
							Add mixin ( #168 )  
						
						 
						
						
						
						
					 
					
						2024-06-01 19:05:46 +08:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								wa22 
							
						 
					 
					
						
						
						
						
							
						
						
							8f0984817d 
							
						 
					 
					
						
						
							
							fix val with half  
						
						 
						
						
						
						
					 
					
						2024-05-30 15:46:16 +08:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								wa22 
							
						 
					 
					
						
						
						
						
							
						
						
							1f6d1fc7e6 
							
						 
					 
					
						
						
							
							fix YOLO init  
						
						 
						
						
						
						
					 
					
						2024-05-28 21:13:14 +08:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								wa22 
							
						 
					 
					
						
						
						
						
							
						
						
							62aaafb3a0 
							
						 
					 
					
						
						
							
							fix export tensorrt with dynamic size  
						
						 
						
						
						
						
					 
					
						2024-05-28 09:30:11 +08:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								wa22 
							
						 
					 
					
						
						
						
						
							
						
						
							9f73bc7768 
							
						 
					 
					
						
						
							
							fix predict with class filter  
						
						 
						
						
						
						
					 
					
						2024-05-27 13:43:44 +08:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								wa22 
							
						 
					 
					
						
						
						
						
							
						
						
							c617472b55 
							
						 
					 
					
						
						
							
							update README  
						
						 
						
						
						
						
					 
					
						2024-05-26 23:58:44 +08:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								Thomas Friedel 
							
						 
					 
					
						
						
							
							
						
						
						
							
						
						
							799ff3be47 
							
						 
					 
					
						
						
							
							fix for predicting with batch_size > 1 ( #47 )  
						
						 
						
						... 
						
						
						
						* fix for predicting with batch_size > 1 
						
						
					 
					
						2024-05-26 19:13:12 +08:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								wa22 
							
						 
					 
					
						
						
						
						
							
						
						
							7a8f9643d2 
							
						 
					 
					
						
						
							
							fix print val map  
						
						 
						
						
						
						
					 
					
						2024-05-26 03:49:16 +00:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								Thomas Friedel 
							
						 
					 
					
						
						
							
							
						
						
						
							
						
						
							2f6208c356 
							
						 
					 
					
						
						
							
							fix for KeyError: 'epoch' ( #48 )  
						
						 
						
						... 
						
						
						
						* fix for KeyError: 'epoch' 
						
						
					 
					
						2024-05-26 10:32:05 +08:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								wa22 
							
						 
					 
					
						
						
						
						
							
						
						
							f19f3e521f 
							
						 
					 
					
						
						
							
							fix val each epoch  
						
						 
						
						
						
						
					 
					
						2024-05-25 02:05:42 +00:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								wa22 
							
						 
					 
					
						
						
						
						
							
						
						
							4197c99fbf 
							
						 
					 
					
						
						
							
							fix resume training  
						
						 
						
						
						
						
					 
					
						2024-05-24 15:27:28 +00:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								wa22 
							
						 
					 
					
						
						
						
						
							
						
						
							66bca50c47 
							
						 
					 
					
						
						
							
							fix non-coco val  
						
						 
						
						
						
						
					 
					
						2024-05-24 07:38:21 +00:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								wa22 
							
						 
					 
					
						
						
						
						
							
						
						
							483d7a9050 
							
						 
					 
					
						
						
							
							update  
						
						 
						
						
						
						
					 
					
						2024-05-24 06:23:19 +00:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								wa22 
							
						 
					 
					
						
						
						
						
							
						
						
							b714fa8bae 
							
						 
					 
					
						
						
							
							update  
						
						 
						
						
						
						
					 
					
						2024-05-24 05:40:00 +00:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								wa22 
							
						 
					 
					
						
						
						
						
							
						
						
							8d9f45a955 
							
						 
					 
					
						
						
							
							add yolov10  
						
						 
						
						
						
						
					 
					
						2024-05-23 14:12:00 +00:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								Glenn Jocher 
							
						 
					 
					
						
						
							
							
						
						
						
							
						
						
							5be2ffbd13 
							
						 
					 
					
						
						
							
							ultralytics 8.1.34 Inference API robust imgsz checks (#9274 )  
						
						 
						
						... 
						
						
						
						Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com> 
						
						
					 
					
						2024-03-25 02:00:38 +01:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								Muhammad Rizwan Munawar 
							
						 
					 
					
						
						
							
							
						
						
						
							
						
						
							dcb953bc41 
							
						 
					 
					
						
						
							
							Add  https://youtu.be/uDrn9QZJ2lk  and object_counting.py, ai_gym.py updates ( #9265 )  
						
						 
						
						
						
						
					 
					
						2024-03-24 18:22:17 +01:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								Kalen Michael 
							
						 
					 
					
						
						
							
							
						
						
						
							
						
						
							ec1d110689 
							
						 
					 
					
						
						
							
							ultralytics 8.1.33 fix HUB model checks (#9153 )  
						
						 
						
						... 
						
						
						
						Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: Laughing <61612323+Laughing-q@users.noreply.github.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com> 
						
						
					 
					
						2024-03-24 06:14:15 +01:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								Glenn Jocher 
							
						 
					 
					
						
						
							
							
						
						
						
							
						
						
							fc6c66a4a4 
							
						 
					 
					
						
						
							
							Fix OpenVINO missing batch-size bug ( #9264 )  
						
						 
						
						
						
						
					 
					
						2024-03-24 05:56:37 +01:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								Laughing 
							
						 
					 
					
						
						
							
							
						
						
						
							
						
						
							33607ca278 
							
						 
					 
					
						
						
							
							Add bgr hyperparameter ( #9139 )  
						
						 
						
						... 
						
						
						
						Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com> 
						
						
					 
					
						2024-03-23 23:17:00 +01:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								Glenn Jocher 
							
						 
					 
					
						
						
							
							
						
						
						
							
						
						
							ebbbdd7e25 
							
						 
					 
					
						
						
							
							Fix IS_PYTHON_3_12 bug ( #9258 )  
						
						 
						
						... 
						
						
						
						Co-authored-by: UltralyticsAssistant <web@ultralytics.com> 
						
						
					 
					
						2024-03-23 21:18:15 +01:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								Glenn Jocher 
							
						 
					 
					
						
						
							
							
						
						
						
							
						
						
							6de99a29e6 
							
						 
					 
					
						
						
							
							ultralytics 8.1.32 fix CLIP backwards compatibility (#9253 )  
						
						 
						
						... 
						
						
						
						Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com> 
						
						
					 
					
						2024-03-23 18:39:22 +01:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								Glenn Jocher 
							
						 
					 
					
						
						
							
							
						
						
						
							
						
						
							7d2e94bbe2 
							
						 
					 
					
						
						
							
							Limit ray<2.9.3 due to bug in ray==2.10.0 ( #9254 )  
						
						 
						
						... 
						
						
						
						Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com> 
						
						
					 
					
						2024-03-23 18:27:14 +01:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								Muhammad Rizwan Munawar 
							
						 
					 
					
						
						
							
							
						
						
						
							
						
						
							fbb180da36 
							
						 
					 
					
						
						
							
							Add  https://youtu.be/aeAX6vWpfR0  to docs & african-wildlife dataset docs page ( #9102 )  
						
						 
						
						... 
						
						
						
						Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com> 
						
						
					 
					
						2024-03-23 16:20:06 +01:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								zhaoruibing 
							
						 
					 
					
						
						
							
							
						
						
						
							
						
						
							528793f452 
							
						 
					 
					
						
						
							
							Fix TypeError in check_cfg() ( #9245 )  
						
						 
						
						... 
						
						
						
						Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com> 
						
						
					 
					
						2024-03-23 16:09:28 +01:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								Glenn Jocher 
							
						 
					 
					
						
						
							
							
						
						
						
							
						
						
							3c179f87cb 
							
						 
					 
					
						
						
							
							ultralytics 8.1.31 NCNN and CLIP updates (#9235 )  
						
						 
						
						... 
						
						
						
						Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com> 
						
						
					 
					
						2024-03-22 23:51:50 +01:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								Mo Li 
							
						 
					 
					
						
						
							
							
						
						
						
							
						
						
							292e028779 
							
						 
					 
					
						
						
							
							fix yolo classify model loading error ( #9196 )  
						
						 
						
						
						
						
					 
					
						2024-03-22 18:04:34 +01:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								Kalen Michael 
							
						 
					 
					
						
						
							
							
						
						
						
							
						
						
							8617fcf32d 
							
						 
					 
					
						
						
							
							ultralytics 8.1.30 add advanced HUB train arguments (#9110 )  
						
						 
						
						... 
						
						
						
						Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com> 
						
						
					 
					
						2024-03-20 15:53:00 -07:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								Muhammad Rizwan Munawar 
							
						 
					 
					
						
						
							
							
						
						
						
							
						
						
							e4afd47a6e 
							
						 
					 
					
						
						
							
							Add brain-tumor dataset docs page ( #9041 )  
						
						 
						
						... 
						
						
						
						Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com> 
						
						
					 
					
						2024-03-18 22:13:01 -07:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								Glenn Jocher 
							
						 
					 
					
						
						
							
							
						
						
						
							
						
						
							ab712288f7 
							
						 
					 
					
						
						
							
							ultralytics 8.1.29 improved disk space checking on correct path (#8977 )  
						
						 
						
						... 
						
						
						
						Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: Kayzwer <68285002+Kayzwer@users.noreply.github.com> 
						
						
					 
					
						2024-03-16 01:54:45 +01:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								Kayzwer 
							
						 
					 
					
						
						
							
							
						
						
						
							
						
						
							2d513a9e4b 
							
						 
					 
					
						
						
							
							ultralytics 8.1.28 avoid * ops on bool Tensors for RT-DETR OpenVINO export (#8937 )  
						
						 
						
						... 
						
						
						
						Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com> 
						
						
					 
					
						2024-03-15 01:20:10 +01:00  
					
					
						 
						
							
							
							 
						
					 
				 
			
				
					
						
							
							
								 
								UltralyticsAssistant 
							
						 
					 
					
						
						
						
						
							
						
						
							bc34ae560b 
							
						 
					 
					
						
						
							
							Auto-format by  https://ultralytics.com/actions  
						
						 
						
						
						
						
					 
					
						2024-03-15 00:12:44 +00:00