ultralytics / ultralytics

Ultralytics YOLO11 πŸš€
https://docs.ultralytics.com
GNU Affero General Public License v3.0
32.53k stars 6.26k forks source link

Facing OSError: [Errno 22] Invalid argument: '.' while converting COCO json format to Yolo format along with keypoints #14054

Closed Aniketiitk21 closed 4 months ago

Aniketiitk21 commented 4 months ago

Search before asking

YOLOv8 Component

Other

Bug

I tried the following code:

from ultralytics.data.converter import convert_coco

convert_coco(labels_dir="/content/Data conversion", use_keypoints=True)

it was working in the morning but now it is showing following error Screenshot 2024-06-27 220023

Please tell how to proceed with this type of error.

Environment

No response

Minimal Reproducible Example

!pip install ultralytics==8.0.196

from ultralytics.data.converter import convert_coco

convert_coco(labels_dir="/content/Data conversion", use_keypoints=True)

Additional

No response

Are you willing to submit a PR?

github-actions[bot] commented 4 months ago

πŸ‘‹ Hello @Aniketiitk21, 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.

Install

Pip install the ultralytics package including all requirements in a Python>=3.8 environment with PyTorch>=1.8.

pip install ultralytics

Environments

YOLOv8 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

Ultralytics CI

If 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.

Aniketiitk21 commented 4 months ago

I was converting the following json file, I'm using Google Colab for this purpose: COCO_Side_2.json

while this I faced the above issue.

Aniketiitk21 commented 4 months ago

πŸ‘‹ Hello @Aniketiitk21, 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.

Install

Pip install the ultralytics package including all requirements in a Python>=3.8 environment with PyTorch>=1.8.

pip install ultralytics

Environments

YOLOv8 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

Ultralytics CI

If 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.

I was converting the following json file, I'm using Google Colab for this purpose: COCO_Side_2.json

while this I faced the above issue.

glenn-jocher commented 4 months ago

Hello @Aniketiitk21,

Thank you for providing the details and the JSON file. The OSError: [Errno 22] Invalid argument: '.' typically indicates an issue with the file path or naming conventions that might not be supported by the underlying file system.

Here are a few steps to troubleshoot and resolve this issue:

  1. Check File Paths: Ensure that the paths you are using do not contain any special characters or spaces that might cause issues. For example, you can rename your directory from Data conversion to Data_conversion to avoid spaces.

  2. Update Ultralytics Package: Verify that you are using the latest version of the ultralytics package. You can update it using:

    pip install --upgrade ultralytics
  3. Reproducible Example: If the issue persists, please provide a minimum reproducible example. This helps us understand the context better and debug the issue effectively. You can refer to our minimum reproducible example guide for more details.

  4. Code Example: Here’s a modified version of your code to ensure paths are handled correctly:

    from ultralytics.data.converter import convert_coco
    
    # Ensure the directory name does not contain spaces or special characters
    convert_coco(labels_dir="/content/Data_conversion", use_keypoints=True)
  5. File System Compatibility: If you are using Google Colab, ensure that the file system is mounted correctly and you have the necessary permissions to read/write in the specified directories.

Please try these steps and let us know if the issue persists. If you encounter any further errors, providing the exact error message and a snippet of your code will help us assist you better.

Aniketiitk21 commented 4 months ago

Hello @glenn-jocher, Thank you for your quick response, the issue has been resolved. It was an issue with my Google Colab file.

glenn-jocher commented 4 months ago

Hello @Aniketiitk21,

I'm glad to hear that the issue has been resolved! πŸŽ‰ If you have any more questions or run into any other issues, feel free to reach out. The YOLO community and the Ultralytics team are always here to help.

Happy coding! πŸš€