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
The MegEngine Implementation of DenseNet(Densely Connected Convolutional Networks).
Usage
Install dependency.
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/
python convert_weights.py -m densenet121
Import from megengine.hub:
Way 1:
frommegengineimporthubmodelhub=hub.import_module(repo_info='asthestarsfalll/densenet-megengine', git_host='github.com')
# load DenseNet model and custom on you ownresnest=modelhub.DenseNet(32, (6, 12, 24, 16), 64, num_classes=10)
# load pretrained model pretrained_model=modelhub.densenet121(pretrained=True)
Way 2:
frommegengineimporthub# load pretrained model model_name='densenet121'pretrained_model=hub.load(
repo_info='asthestarsfalll/densenet-megengine', entry=model_name, git_host='github.com', pretrained=True)
Currently support densenet121 and densenet161, but you can run convert_weights.py to convert other models(densenet169 and densenet201).
For example: