Skip to content

Conversation

@wasd96040501
Copy link

fix #4

def output_align(input, output):
    """
    In testing, sometimes output is several pixels less than irregular-size input,
    here is to fill them
    """
    if output.size() != input.size():
        diff_width = input.size(-1) - output.size(-1)
        diff_height = input.size(-2) - output.size(-2)
        m = nn.ReplicationPad2d((0, diff_width, 0, diff_height))
        output = m(output)

    return output

This function is from @youyuge34
Because images are resized to (256, 256) in training stage, this function has no side effect when running in training stage.

@wasd96040501 wasd96040501 reopened this Mar 8, 2019
@GuardSkill
Copy link

but the outputs in the forwarding process are not a single one, can it add into the forwarding process like this?
self.output_align(inputs,outputs)

@Mistariano
Copy link

but the outputs in the forwarding process are not a single one, can it add into the forwarding process like this?
self.output_align(inputs,outputs)

In test mode the batch size is set to 1 so, from my perspective, it's ok.


BTW my solution for the problem is to apply a resizing transformation on those images in load_item in dataset.py

def load_item(self, index):
    ...
    if size != 0:
        img = self.resize(img, size, size)
    else:
        img = self.resize(img, img.shape[0] // 4 * 4, img.shape[1] // 4 * 4)
    
    # also apply it on masks and edges

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A bug that edge image size will change after EdgeModel

4 participants