You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This implementation may be much slower than the torch implementation, due to there is a big gap in the AdaptiveAvgPool API between megengine and torch.
In MegEngine, AdaptiveAvgPool is adpted from AvgPool by automatically infer kernel_size and stride. However, torch's implementation of AdaptiveAvgPool are highly diferent which uses diferent kernel_size and stride when sliding window. You can get more details from here.
Check the class AdaptiveAvgPooling2D() in models.pooling to help you understand how torch's implementation do.
Usage
Install Dependencies
pip install -r requirements.txt
If you don't want to compare the ouput error between the MegEngine implementation and PyTorch one, just ignore requirements.txt and install MegEngine from the command line:
Convert trained weights from torch to megengine, the converted weights will be saved in ./pretained/ , you need to specify the convert model architecture and path to checkpoint offered by official repo.
frommegengineimporthub# load pretrained model model_name='pspnet50'pretrained_model=hub.load(
repo_info='asthestarsfalll/PSPNet-MegEngine:main', entry=model_name, git_host='github.com', pretrained=True)
For those models which do not have pretrained model online, you need to convert weights mannaly, and load the model without pretrained weights like this: