-
-
Notifications
You must be signed in to change notification settings - Fork 5k
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
argument save_dir doesn't work #13041
Comments
👋 Hello @AN-ZE, thank you for your interest in Ultralytics YOLOv8 🚀! We recommend a visit to the Docs for new users where you can find many Python and CLI usage examples and where many of the most common questions may already be answered. If this is a 🐛 Bug Report, please provide a minimum reproducible example to help us debug it. If this is a custom training ❓ Question, please provide as much information as possible, including dataset image examples and training logs, and verify you are following our Tips for Best Training Results. Join the vibrant Ultralytics Discord 🎧 community for real-time conversations and collaborations. This platform offers a perfect space to inquire, showcase your work, and connect with fellow Ultralytics users. InstallPip install the pip install ultralytics EnvironmentsYOLOv8 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
StatusIf this badge is green, all Ultralytics CI tests are currently passing. CI tests verify correct operation of all YOLOv8 Modes and Tasks on macOS, Windows, and Ubuntu every 24 hours and on every commit. |
@AN-ZE there is no |
Sorry to comment on an old PR, but I have an issue that is related to this PR.
The issue that I encounter is saving the visualization. It appears that I can send overrides to predict() to use with the predictor, but save_dir was specifically removed from overrides in this PR specifically. How do I specify save_dir now? Using Result class is not good enough as I want to save the visualization created with predict(img, visualize=True) somewhere I know. Since the predictor is essentially "lazy loaded", and since it removes the save_dir as a feature, I can't really rely on doing predict(img, visualized=True, save_dir="/tmp/somedir"). Do I now need to do an empty predict, then pass in an override? I expected to be able to do something like this : temp_dir = tempfile.mkdtemp()
model.predict(image, visualize=True, save_dir=temp_dir) Instead, I seem to be forced to actually move the files after the fact, like this : model.predict(image, visualize=True)
#move everything into the tmp folder
temp_dir = tempfile.mkdtemp()
shutil.move(model.predictor.save_dir, temp_dir) Why was save_dir removed in #4480? Update: https://docs.ultralytics.com/reference/engine/predictor/ seems to still refer to an argument called save_dir, so I would have expected it to be able to be overriden. |
@AlexandreOuellet hello! Thanks for reaching out with your query. I understand the confusion regarding the In the current implementation of the YOLOv8 To save the visualizations to a specific directory, you can indeed move the files after prediction as you've described. Here's a streamlined approach: import shutil
import tempfile
from ultralytics import YOLO
# Load your model
model = YOLO('path/to/model.pt')
# Run prediction
results = model.predict('path/to/image.jpg', visualize=True)
# Create temporary directory and move files
temp_dir = tempfile.mkdtemp()
for path in results.files:
shutil.move(path, temp_dir) This method ensures that all generated files from the prediction are moved to your desired temporary directory. We appreciate your feedback on this, and I'll relay it to our development team to consider reintroducing or modifying the |
@AlexandreOuellet |
Search before asking
YOLOv8 Component
Train
Bug
use python environment train and predict.
results = model.train(data='ultralytics/cfg/datasets/VOC.yaml',
save_dir='/home/lutos/anze/ultralytics/yolov8n')
results = model(img_path,
save_dir='/home/lutos/anze/ultralytics/yolov8n_qrcode')
The save_dir argument doesn't work,
My thoughts #8912
adding this argument to the file(ultralytics/cfg/default.yaml) can fix this problem.
Environment
ubuntu20.04
git clone new master.
Minimal Reproducible Example
No response
Additional
No response
Are you willing to submit a PR?
The text was updated successfully, but these errors were encountered: