deep-learning-random-explore icon indicating copy to clipboard operation
deep-learning-random-explore copied to clipboard

Doubt regarding inception v3 monkey patching

Open Kshitij09 opened this issue 6 years ago • 3 comments

In cnn_archs notebook you mentioned we need to monkey patch the forward pass(excluding final layers). But it seems like you've also excluded initial transform_input part as well.

if self.transform_input:
            x = x.clone()
            x[:, 0] = x[:, 0] * (0.229 / 0.5) + (0.485 - 0.5) / 0.5
            x[:, 1] = x[:, 1] * (0.224 / 0.5) + (0.456 - 0.5) / 0.5
            x[:, 2] = x[:, 2] * (0.225 / 0.5) + (0.406 - 0.5) / 0.5

Although I tried to add these lines to your notebook and it ran without any issue. But is there any specific reason to skip this part ?

Kshitij09 avatar Dec 26 '19 08:12 Kshitij09

Hi @Kshitij09, You're right, I think I copied the _forward function of this line, rather than the forward function, so I overlooked the transform input part...

PPPW avatar Dec 30 '19 22:12 PPPW

@PPPW thanks for the clarification. Excellent work btw. this notebook has helped me a lot!

Can I use this thread to ask any further questions or do you have any forum for discussion?

Kshitij09 avatar Jan 02 '20 11:01 Kshitij09

Hi @Kshitij09, I'm glad you find it useful! Yes, feel free to ask any questions in here or in the fastai forum, I'm also learning and will happy to discuss

PPPW avatar Jan 03 '20 00:01 PPPW