Difference between transform, target_transform and transforms in VOC_DETECTION_DATASET


I was checking the documentation of the VOC dataset provided by pytorch. I saw that there are three parameters very similar: transform, target_transform and transforms. As far as I understood transforms apply the same transformation to the rgb and the label. However, I didn’t see that “transforms” functionality in the pytorch documentation. How can I generate this transforms function that VOC detection dataset requires?


You could either define a custom transformation, which accepts the image and target or use e.g. the segmentation transformations, which also accept these two arguments.

Thanks! The documentation of these methods is not included in the official documentation, right? Because, yesterday I was loooking for this methods in the documenetaiton and I was not able to find it.

I’m not sure what the current plan for the references is and if these transformations should eventually land in an own module or be used in another way.

CC @fmassa, @pmeier

If these transformations should become available in a submodule, would you be interested in adding the docs @Dhorka?


However, I didn’t see that “transforms” functionality in the pytorch documentation.

You are right about the lack of documentation about this. Have a look at this issue. The author had a similar question.

I faced some time ago the same problem. If @Dhorka is not interested, I’m volunteering to help to document this submodule.

1 Like

That sounds fantastic. :slight_smile:
I would recommend to create a new issue with your suggestion and tag @pmeier as well as @fmassa to discuss the documentation.

Just to be sure. Do you want me to create the issue on GitHub?

Yes, please create an issue for that linking this thread and tag me. If you can, please also link other issues related to yours. Otherwise I’ll link them. After you have created an issue we can discuss this with @fmassa and you can send a PR fixing this.