In other code snippets the transformation was most likely only applied to the data, so a single transform argument was passed.
For the CocoDetection dataset, you are transforming the data and target, so you should either pass the transformations separately or provide a transformation function, which accepts the data and the target as arguments.



 reallyclean-sauce:

And why would the number of positional arguments I passed be 3, when it is clearly two?


The self argument is also counted in Python.



 reallyclean-sauce:

Do you think maybe it is just not maintained to the latest version?


No, I don’t think so.
EDIT: Note that these arguments are optional, so you can also pass your transformation as transform=get_transform() only to skip the target transformation.