apple / ml-cvnets

CVNets: A library for training computer vision networks
https://apple.github.io/ml-cvnets
Other
1.76k stars 225 forks source link

AttributeError: 'NoneType' object has no attribute 'size' #99

Closed Tranbaber closed 11 months ago

Tranbaber commented 11 months ago

When I train the coco dataset with mobilevitv2 on a computer with only one GPU, I have the following issue:

“2023-09-28 13:05:49 - LOGS - Using EMA 2023-09-28 13:05:49 - LOGS - No checkpoint found at 'results/train/training_checkpoint_last.pt' 2023-09-28 13:05:49 - INFO - Configuration file is stored here: results/train/config.yaml

2023-09-28 13:05:51 - DEBUG - Training epoch 0 with 117266 samples 2023-09-28 13:05:51 - LOGS - Exception occurred that interrupted the training: Traceback (most recent call last): File "D:\Study\pycharm_projects\MobileViTv2\ml-cvnets-main\engine\training_engine.py", line 606, in run train_loss, train_ckpt_metric = self.train_epoch(epoch) File "D:\Study\pycharm_projects\MobileViTv2\ml-cvnets-main\engine\training_engine.py", line 230, in train_epoch for batch_id, batch in enumerate(self.train_loader): File "C:\Users\72344.conda\envs\MobileViTv2\lib\site-packages\torch\utils\data\dataloader.py", line 681, in next data = self._next_data() File "C:\Users\72344.conda\envs\MobileViTv2\lib\site-packages\torch\utils\data\dataloader.py", line 721, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "C:\Users\72344.conda\envs\MobileViTv2\lib\site-packages\torch\utils\data_utils\fetch.py", line 49, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "C:\Users\72344.conda\envs\MobileViTv2\lib\site-packages\torch\utils\data_utils\fetch.py", line 49, in data = [self.dataset[idx] for idx in possibly_batched_index] File "D:\Study\pycharm_projects\MobileViTv2\ml-cvnets-main\data\datasets\detection\coco_ssd.py", line 157, in getitem im_width, im_height = image.size AttributeError: 'NoneType' object has no attribute 'size' ” I would like to get everyone's help, thank you very much @mchorton

mjamroz commented 11 months ago

Does. 'results/train/training_checkpoint_last.pt' exists? Does your training dataset contains proper images? Error looks like your image hasnt been loaded. Try to create training/testing datasets from only one class and one file and try again- if that works it means some other files of your dataset are correpted, if that doesnt work probably configuration problem.

Tranbaber commented 11 months ago

@mjamroz Ok,I will try it again! Thank you!