YOLOv6 icon indicating copy to clipboard operation
YOLOv6 copied to clipboard

Problem when training with custom dataset

Open leonokida opened this issue 1 year ago • 1 comments

Before Asking

  • [X] I have read the README carefully. 我已经仔细阅读了README上的操作指引。

  • [X] I want to train my custom dataset, and I have read the tutorials for training your custom data carefully and organize my dataset correctly; (FYI: We recommand you to apply the config files of xx_finetune.py.) 我想训练自定义数据集,我已经仔细阅读了训练自定义数据的教程,以及按照正确的目录结构存放数据集。(FYI: 我们推荐使用xx_finetune.py等配置文件训练自定义数据集。)

  • [X] I have pulled the latest code of main branch to run again and the problem still existed. 我已经拉取了主分支上最新的代码,重新运行之后,问题仍不能解决。

Search before asking

  • [X] I have searched the YOLOv6 issues and found no similar questions.

Question

Hello, I'm having the following problem when training with a custom dataset. I have searched and I didn't find anyone with a similar problem:

Traceback (most recent call last): File "/lustre04/scratch/leonokid/YOLOv6/tools/train.py", line 143, in main(args) File "/lustre04/scratch/leonokid/YOLOv6/tools/train.py", line 128, in main trainer = Trainer(args, cfg, device) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/lustre04/scratch/leonokid/YOLOv6/yolov6/core/engine.py", line 91, in init self.train_loader, self.val_loader = self.get_data_loader(self.args, self.cfg, self.data_dict) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/lustre04/scratch/leonokid/YOLOv6/yolov6/core/engine.py", line 386, in get_data_loader train_loader = create_dataloader(train_path, args.img_size, args.batch_size // args.world_size, grid_size, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/lustre04/scratch/leonokid/YOLOv6/yolov6/data/data_load.py", line 46, in create_dataloader dataset = TrainValDataset( ^^^^^^^^^^^^^^^^ File "/lustre04/scratch/leonokid/YOLOv6/yolov6/data/datasets.py", line 82, in init self.img_paths, self.labels = self.get_imgs_labels(self.img_dir) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/lustre04/scratch/leonokid/YOLOv6/yolov6/data/datasets.py", line 325, in get_imgs_labels cache_info = json.load(f) ^^^^^^^^^^^^ File "/cvmfs/soft.computecanada.ca/easybuild/software/2020/avx512/Core/python/3.11.5/lib/python3.11/json/init.py", line 293, in load return loads(fp.read(), ^^^^^^^^^^^^^^^^ File "/cvmfs/soft.computecanada.ca/easybuild/software/2020/avx512/Core/python/3.11.5/lib/python3.11/json/init.py", line 346, in loads return _default_decoder.decode(s) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/cvmfs/soft.computecanada.ca/easybuild/software/2020/avx512/Core/python/3.11.5/lib/python3.11/json/decoder.py", line 340, in decode raise JSONDecodeError("Extra data", s, end) json.decoder.JSONDecodeError: Extra data: line 1 column 3253329 (char 3253328)

The command I'm using to run the training is: python tools/train.py --batch 16 --conf $1 --data data/dataset.yaml --img-size 640 --fuse_ab --device 0 --name $2 --epochs 100 Where $1 is the path to the config file (yolov6n_finetune.py and etc.)

The dataset is available here

Additional

No response

leonokida avatar Nov 10 '23 15:11 leonokida

You can delete the cached json file in the directory of the dataset. May be this cached json file is damaged.

mtjhl avatar Nov 13 '23 02:11 mtjhl