Skip to content

Confusion about interpolating #2

@ajwimmers

Description

@ajwimmers

On notebook 6, there is the code:

Step 3: Resize using interpolate
Now input_tensor is (1, 1, 32, 32), which matches the 2D spatial size expected by interpolate
more_points = F.interpolate(input_tensor, size=(36, 36), mode='bilinear', align_corners=False)

This step, and maybe the process that it's a part of, does not explain itself very well and will probably throw the students off even more than it threw me off.

I experimented with running the filter on the original 32x32 image, but the result was very sharp and harder to interpret. So interpolating the image to 36 x 36 seems to be effective, but I can't discern the reason from any of the comments or code. My leading guesses are that 1) this helps smooth it just enough to make the point about what a sharpness filter does, so it's an expedient way to get there, and/or 2) it helps set up the user for the interpolations performed later on, in which the original image is interpolated to a new size just to make the process more uniform. I'm not perfectly at ease with either of those explanations though, because they're not normal practice in ML.

So if there's an appropriate reason, it should be added here. But if we just have to share a best guess for why this is done (with a side comment that you don't have to adopt this in standard practice), then go with that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions