From the docs 7 for CocoDetection:



transform  ( callable ,  optional ) – A function/transform that takes in an PIL image and returns a transformed version. E.g,  transforms.ToTensor


target_transform  ( callable ,  optional ) – A function/transform that takes in the target and transforms it.

transforms  ( callable ,  optional ) – A function/transform that takes input sample and its target as entry and returns a transformed version.


You could either pass the transform and target_transform separately or use a transforms function, which accepts the image and target.