Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I want to overwrite and save the analysis results #9522

Closed
1 task done
Heartful-echo opened this issue Sep 21, 2022 · 8 comments · Fixed by #9617
Closed
1 task done

I want to overwrite and save the analysis results #9522

Heartful-echo opened this issue Sep 21, 2022 · 8 comments · Fixed by #9617
Labels
question Further information is requested

Comments

@Heartful-echo
Copy link

Search before asking

Question

Hi

Analysis results are stored in the exp folder of the run folder, but the exp folder increases each time analysis is performed. For example exp1⇨exp2.

Is it possible to fix this exp folder and always overwrite the analysis results?

Additional

No response

@Heartful-echo Heartful-echo added the question Further information is requested label Sep 21, 2022
@barney2074
Copy link

I'm not sure if using the --name argument with detect.py will overwrite previous results (of the same name)
It looks like the increment_path function in general.py will create a new folder..?
You could modify this

For this issue- rather than writing to text files, I log the infererence results to a time-series database (I used Influx)

@glenn-jocher
Copy link
Member

You can use —exist-ok to overwrite existing logging directory

@Heartful-echo
Copy link
Author

Heartful-echo commented Sep 22, 2022

Thank you everybody.

I'm not using detect.py. I'm using the code below in my original.

model = torch.hub.load('xxxxxxx')
model.classes = [0]
model.conf = 0.25

imgs = ['./image.jpg']
results = model(imgs, size=640)
results.save()

When you execute results.save(), the exp folder will increase.
Exp, exp1, exp2, etc. will increase each time it is executed.
I want exp only. I would like to overwrite the result.

Isn't there an option like "model.classes = [0]"?

@glenn-jocher
Copy link
Member

glenn-jocher commented Sep 22, 2022

@kazuya-uchida

results.save(save_dir='path/to/save_dir')

@Heartful-echo
Copy link
Author

@glenn-jocher

Thank you for your advice.

I tried.
results.save(save_dir='runs/detect/exp')
However, exp2, exp3, exp4 and new directories were generated as shown in the attached image.
I always want the result to be overwritten and stored inside the exp directory.
What is causing this?
キャプチャ

@glenn-jocher
Copy link
Member

@kazuya-uchida good news 😃! Your original issue may now be fixed ✅ in PR #9617. Now you can pass exist_ok=True to save results to the same directory.

To receive this update:

  • Gitgit pull from within your yolov5/ directory or git clone https://github.com/ultralytics/yolov5 again
  • PyTorch Hub – Force-reload model = torch.hub.load('ultralytics/yolov5', 'yolov5s', force_reload=True)
  • Notebooks – View updated notebooks Open In Colab Open In Kaggle
  • Dockersudo docker pull ultralytics/yolov5:latest to update your image Docker Pulls

Thank you for spotting this issue and informing us of the problem. Please let us know if this update resolves the issue for you, and feel free to inform us of any other issues you discover or feature requests that come to mind. Happy trainings with YOLOv5 🚀!

@Heartful-echo
Copy link
Author

Heartful-echo commented Sep 27, 2022

@glenn-jocher
Thanks for the very good news.
Today will be a good day.

I have verified that it works as expected!
The result is always overwritten!
results.save(save_dir='runs/detect/exp', exist_ok=True)

@glenn-jocher
Copy link
Member

@Heartful-echo i'm glad to hear that it's working as expected for you! 😊 If you have any more questions or need further assistance, feel free to ask. Happy coding and have a great day! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants