Normally the COCO dataset uses the official loaders provided by the COCO dataset 65, so if there is a problem with it, it might be that your data is not exactly in the format provided by the dataset.
Also, to make your life easier to debug, you don’t need to call next on the dataloader, but just use the dataset and index it
images, labels = det[0] # idx of your img, here 0