Skip to content

Replace deprecated ResizeBilinear for EAST #479

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions mindocr/models/necks/fpn.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,17 +280,17 @@ def __init__(self, in_channels, out_channels=128):
def construct(self, features):
f1, f2, f3, f4 = features

out = ops.ResizeBilinear(f3.shape[2:], True)(f4)
out = ops.ResizeBilinearV2(True)(f4, f3.shape[2:])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will operator initialization inside construct affect execution speed in PyNative mode? Will it be better to initialize the operator once in __init__ (e.g. self.resize = ops.ResizeBilinearV2(True)) and then use it directly inside construct?

Copy link
Collaborator Author

@VictorHe-1 VictorHe-1 Jul 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's better to define ops.ResizeBilinearV2(True) in __init__, then call it in the construct function. But I'm not sure if it will be a problem to export the existing ckpt file to MindIR after adding this line of code. The above codes are ok for the current ckpt file to export.

Copy link
Collaborator Author

@VictorHe-1 VictorHe-1 Jul 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try it now

out = self.concat((out, f3))
out = self.relu1(self.bn1(self.conv1(out)))
out = self.relu2(self.bn2(self.conv2(out)))

out = ops.ResizeBilinear(f2.shape[2:], True)(out)
out = ops.ResizeBilinearV2(True)(out, f2.shape[2:])
out = self.concat((out, f2))
out = self.relu3(self.bn3(self.conv3(out)))
out = self.relu4(self.bn4(self.conv4(out)))

out = ops.ResizeBilinear(f1.shape[2:], True)(out)
out = ops.ResizeBilinearV2(True)(out, f1.shape[2:])
out = self.concat((out, f1))
out = self.relu5(self.bn5(self.conv5(out)))
out = self.relu6(self.bn6(self.conv6(out)))
Expand Down