RuntimeError: expected a non-empty list of Tensors
Hi @xieyufei1993, when training model I got an error such as: (fots) loitg@loitg-Precision-T3600:~/Desktop/tu_workspace/FOTS$ python main_train.py use config: initial_epoch 0 epoch_num 30000 lr 0.001 decay 0.0005 use_gpu True batch_size 64 num_workers 10 optmizer RMSprop betas (0.5, 0.999) epsilon 0.0001 shrink_side_ratio 0.6 shrink_ratio 0.2 model FOTS patience 2 load_weights False lambda_inside_score_loss 4.0 lambda_side_vertex_code_loss 1.0 lambda_side_vertex_coord_loss 1.0 load_model_path checkpoints/model.pth save_path save_model/ total_img 16243 validation_split_ratio 0.1 max_train_img_size 736 max_predict_img_size 2400 parse <bound method parse of <config.DefaultConfig object at 0x7fe4ff6d5cc0>> end the parse!!!
Epoch 1 / 30000
Traceback (most recent call last):
File "main_train.py", line 95, in
How to fix this error ?. I hope to see your reply soon.
Hi @xieyufei1993, when training model I got an error such as: (fots) loitg@loitg-Precision-T3600:~/Desktop/tu_workspace/FOTS$ python main_train.py use config: initial_epoch 0 epoch_num 30000 lr 0.001 decay 0.0005 use_gpu True batch_size 64 num_workers 10 optmizer RMSprop betas (0.5, 0.999) epsilon 0.0001 shrink_side_ratio 0.6 shrink_ratio 0.2 model FOTS patience 2 load_weights False lambda_inside_score_loss 4.0 lambda_side_vertex_code_loss 1.0 lambda_side_vertex_coord_loss 1.0 load_model_path checkpoints/model.pth save_path save_model/ total_img 16243 validation_split_ratio 0.1 max_train_img_size 736 max_predict_img_size 2400 parse <bound method parse of <config.DefaultConfig object at 0x7fe4ff6d5cc0>> end the parse!!!
Epoch 1 / 30000 Traceback (most recent call last): File "main_train.py", line 95, in main() File "main_train.py", line 90, in main save_step=5, weight_decay=weight_decay) File "main_train.py", line 32, in train for i, (img, score_map, geo_map, training_mask) in enumerate(trainloader): File "/home/loitg/miniconda3/envs/fots/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 582, in next return self._process_next_batch(batch) File "/home/loitg/miniconda3/envs/fots/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 608, in _process_next_batch raise batch.exc_type(batch.exc_msg) RuntimeError: Traceback (most recent call last): File "/home/loitg/miniconda3/envs/fots/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 99, in _worker_loop samples = collate_fn([dataset[i] for i in batch_indices]) File "/home/loitg/Desktop/tu_workspace/FOTS/data/dataset.py", line 672, in collate_fn images = torch.stack(images, 0) RuntimeError: expected a non-empty list of Tensors
How to fix this error ?. I hope to see your reply soon.
I am facing the exact error. if someone has workaround, please let me know.
If you are using ICDAR dataset, the annotation text file normally has "gt_" before the image name.
So you need to edit your dataset.py file starting from line 581 as below:
if os.path.exists(txt_root + "/gt_"+im_name[0:-4] + '.txt'): txt_fn = "gt_"+im_name[0:-4] + '.txt' elif os.path.exists(txt_root + "/gt_"+im_name[0:-5] + '.txt'): txt_fn = "gt_"+im_name[0:-5] + '.txt'