YOLO11:How can I automaticly save the data of the val results

I have a lot of yaml files and use a for loop to train each corresponding model on the ssh server. Now I want to automatically save the verification result data to a file (such as a txt file) after each training and verification, so that I can view and compare the performance of each model later. The data I mean is the one in the picture(map50,map50-95…)

The metrics should be available in the returned object

In [6]: results = model.val(data="coco128.yaml", exist_ok=True)
In [7]: results.results_dict
Out[7]:
{'metrics/precision(B)': np.float64(0.6636419560169069),
 'metrics/recall(B)': np.float64(0.588800650875576),
 'metrics/mAP50(B)': np.float64(0.6714676194841959),
 'metrics/mAP50-95(B)': np.float64(0.5051438725871794),
 'fitness': np.float64(0.5217762472768811)}
1 Like

You could also run your code from the CLI with:

nohup python train.py & 

which will run the training in the background and log the output to a nohup.out log file. Replace train.py with whatever Python script you have to run your for-loop.