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

Path(os.path.relpath(ROOT, Path.cwd())) #13528

Open
1 task done
rickmoddy opened this issue Mar 7, 2025 · 2 comments
Open
1 task done

Path(os.path.relpath(ROOT, Path.cwd())) #13528

rickmoddy opened this issue Mar 7, 2025 · 2 comments
Labels
question Further information is requested

Comments

@rickmoddy
Copy link

Search before asking

Question

Is this line of code redundant? If I move the project to a different path and run the script from there, wouldn't the current working directory already be correct?

Additional

No response

@rickmoddy rickmoddy added the question Further information is requested label Mar 7, 2025
@UltralyticsAssistant
Copy link
Member

👋 Hello @rickmoddy, thank you for your interest in YOLOv5 🚀! Your question is noted, and we appreciate your curiosity about the code implementation. An Ultralytics engineer will assist you soon to provide clarity on your inquiry 😊.

In the meantime, please explore our ⭐️ YOLOv5 Tutorials for detailed guides on code functionality, setups, and advanced features.

To ensure we can assist you effectively, if your question pertains to a possible 🐛 bug or error, please provide a minimum reproducible example. This includes:

  1. The exact code snippets you are running.
  2. Details about your setup, such as your operating system, Python version, PyTorch version, and runtime environment.
  3. A description of how to reproduce the behavior, if relevant.

Requirements

Python>=3.8.0 with all requirements.txt installed including PyTorch>=1.8. To ensure your environment meets the required setup, follow these steps:

git clone https://github.com/ultralytics/yolov5  # clone
cd yolov5
pip install -r requirements.txt  # install

Environments

You can also run YOLOv5 in any of the following cloud environments, which come preinstalled with dependencies:

Status

YOLOv5 CI

If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing ✅. CI tests validate the performance and correctness of YOLOv5 scripts for training, validation, inference, export, and benchmarking across macOS, Windows, and Ubuntu daily and on every commit.

We appreciate your patience and input into improving YOLOv5! 🚀

@pderrenger
Copy link
Member

@rickmoddy this line converts the ROOT directory path to be relative to the current working directory, which ensures consistent path handling when running scripts from different locations. It's intentional and serves to:

  1. Maintain portable relative paths if executing from outside the project directory
  2. Prevent absolute path dependencies in saved results
    The current implementation follows Python best practices for path management across different execution contexts.

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

No branches or pull requests

3 participants