You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
I'm getting this error too. You mentioned before that this could be solved like this:
yolo mode=train task=classify model=yolov8x-cls.pt data=.\datasets\class\1701928298 split=test
,
but it wasn't solved.. what else can I do?
@sarpx
hello! The TypeError you're encountering often suggests that a necessary file path argument is missing or incorrectly specified. Double-check your command for any missing file paths, such as the dataset configuration file or the model weights file. Also, ensure that the paths are properly formatted according to your operating system's conventions.
In the context of classification tasks, ensure you've set the right configuration in the dataset YAML, including the necessary paths for train, val, and test splits. The training command does not typically include a split argument, so assuming you've already configured your dataset correctly, a standard training command would look more like this:
Where
your_dataset.yaml
should be replaced with the path to your actual dataset YAML file that includes definitions for train and val datasets.
If you're still facing issues after these checks, provide more details about the context of your error, such as the complete command you ran and any custom configurations you're using. 😊🛠
@glenn-jocher
I am getting an error like this. When I create a .yaml file, it tries to download something like .zip. I have created many patch files and have never encountered this kind of problem.
RuntimeError: Dataset 'datasets/sinif/sinif_1701928298.yaml' error URL error for https://github.com/ultralytics/yolov5/releases/download/v1.0/\datasets\sinif\sinif_1701928298.yaml.zip: 404 Not Found
@sarpx
you'll want to ensure your directory uses the correct layout for classification tasks. You can find the layout in the docs
here
. When passing to the YOLO model for training, you'll need to pass the top level directory for your dataset.
It may also help to pass the absolute path for the dataset directory instead of the relative path, as your working directory might have a different relative location to your dataset path. Finally, depending on your OS, using / might be preferable to \ for the path location.
Thank you very much for your interest.
Of course, I did what you said, and then we get an error like the one below.
TypeError: expected str, bytes or os.PathLike object, not NoneType
Someone else also opened a question like this: #6874
@sarpx if you're receiving that error, then something else is wrong your may need to update the installed version of Ultralytics as Issue #2774 is from 7 months ago and has been since fixed. I quickly ran a test with the command yolo mode=train task=classify model=yolov8n-cls.pt data=imagenet10 epochs=5 which will download the ImageNet10 dataset to my local computer dataset directory, which for me is Q:\ML_data.
This command completes without issue and I'm using
Ultralytics 8.0.223
on Windows 10. After running this initially, I tested with passing the full dataset directory
yolo mode=train task=classify model=yolov8n-cls.pt data=Q:\ML_data\imagenet10 epochs=5
which also completed without issue. The reason you're seeing
TypeError: expected str, bytes or os.PathLike object, not NoneType
is almost certainly because your install version of Ultralytics has not been updated.
@glenn-jocher
I solved this. If there is no test set in the data, it gives an error. I don't know if there must be a test set in the training?
File "\ultralytics\engine\trainer.py", line 253, in _setup_train
self.test_loader = self.get_dataloader(self.testset, batch_size=batch_size * 2, rank=-1, mode='val')
Great to hear you've resolved it @sarpx! To clarify, YOLOv8 does not require a test set for training. If you’d like to exclude the test set, ensure your dataset YAML does not have a test entry, or set it to null. The error was likely due to the code expecting a test set because it was specified but not found. Happy training! 😊🚀
@glenn-jocher I solved this. If there is no test set in the data, it gives an error. I don't know if there must be a test set in the training?
File "\ultralytics\engine\trainer.py", line 253, in _setup_train
self.test_loader = self.get_dataloader(self.testset, batch_size=batch_size * 2, rank=-1, mode='val')
Can you please tell me how you resolved this error
@koookieee, glad to hear you found a solution! For future reference, a test set is not mandatory for training. If you choose not to use a test set, ensure the 'test' key is omitted or set to null in your dataset YAML file. This will prevent the code from looking for a test set that doesn't exist. Keep up the good work! 😊👍
@koookieee Open a test folder next to the train folder and create folders similar to the structure in the train folder and put a few pictures in it. Putting tests in the yaml file causes other problems. Good luck.
@koookieee, glad to hear you found a solution! For future reference, a test set is not mandatory for training. If you choose not to use a test set, ensure the 'test' key is omitted or set to null in your dataset YAML file. This will prevent the code from looking for a test set that doesn't exist. Keep up the good work! 😊👍