Train an Object Detector with your own 'COCO' dataset in PyTorch

Hi Guys,

I am pretty new using PyTorch, I have successfully trained Yolo object detector on coco dataset using PyTorch, but when i try to train on my custom dataset (coco format) i got this error


Traceback (most recent call last): File "", line 470, in <module> main() File "", line 356, in main for iter_i, (imgs, targets,img_info,idx) in enumerate(dataloader): File "/home/aa33915512/anaconda3/envs/pytorch/lib/python3.7/site-
packages/torch/utils/data/", line 637, in __next__ return self._process_next_batch(batch) File
 "/home/aa33915512/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/utils/data/", line 658, in _process_next_batch raise batch.exc_type(batch.exc_msg) KeyError: 'Traceback (most recent call last):\n
line 138, in _worker_loop\n samples = collate_fn([dataset[i] for i in batch_indices])\n File "/home/aa33915512/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/utils/data/", line 138, in <listcomp>\n samples =
collate_fn([dataset[i] for i in batch_indices])\n File "/home/aa33915512/ASFF/dataset/", line 65, in wrapper\n ret_val = getitem_fn(self, index)\n File "/home/aa33915512/ASFF/dataset/",
 line 49, in __getitem__\n img1, label1, _, _= self._dataset.pull_item(idx)\n File "/home/aa33915512/ASFF/dataset/", line 61, in pull_item\n im_ann = 
self.coco.loadImgs(id_)[0]\n File "/home/aa33915512/anaconda3/envs/pytorch/lib/python3.7/site-packages/pycocotools/", line 230, in loadImgs\n return [self.imgs[id] for id in ids]\n

 "/home/aa33915512/anaconda3/envs/pytorch/lib/python3.7/site-packages/pycocotools/", line 230, in <listcomp>\n return [self.imgs[id] for id in
 ids]\nKeyError: \'F\'\n'


PyTorch version: 1.0.1.post2
Is debug build: False
CUDA used to build PyTorch: 10.0.130
ROCM used to build PyTorch: N/A

OS: Ubuntu 21.04 (x86_64)
GCC version: (Ubuntu 6.4.0-17ubuntu1) 6.4.0 20180424
Clang version: Could not collect
CMake version: version 3.18.4
Libc version: glibc-2.17

Python version: 3.7 (64-bit runtime)
Python platform: Linux-5.11.0-18-generic-x86_64-with-debian-bullseye-sid
Is CUDA available: True
CUDA runtime version: 10.0.130
GPU models and configuration: 
GPU 1: GeForce GT 710

Nvidia driver version: 460.84
cuDNN version: /usr/lib/x86_64-linux-gnu/
HIP runtime version: N/A
MIOpen runtime version: N/A

Versions of relevant libraries:
[pip3] numpy==1.19.2
[pip3] torch==1.2.0
[pip3] torchvision==0.4.0
[conda] blas                      1.0                         mkl  
[conda] cudatoolkit               10.0.130                      0  
[conda] mkl                       2020.2                      256    anaconda
[conda] mkl-service               2.3.0            py37he8ac12f_0  
[conda] mkl_fft                   1.3.0            py37h54f3939_0  
[conda] mkl_random                1.1.1            py37h0573a6f_0  
[conda] numpy                     1.19.2           py37h54aff64_0  
[conda] numpy-base                1.19.2           py37hfa32c7d_0  
[conda] pytorch                   1.0.1           py3.7_cuda10.0.130_cudnn7.4.2_2    pytorch
[conda] torch                     1.2.0                    pypi_0    pypi
[conda] torchvision               0.4.0                    pypi_0    pypi

Any suggestions ?