How to use pretrained models.
See original GitHub issueI try to load pretrained model but get zero accuracy in the begining. In train.py I am doing the following way:
` sym, arg_params, aux_params = mx.model.load_checkpoint(os.path.join(args.pretrained, “model”), args.pretrained_epoch) sym = get_symbol(args) model = mx.mod.Module( context=ctx, symbol=sym, ) model.bind(data_shapes=train_dataiter.provide_data, label_shapes=train_dataiter.provide_label) model.set_params(arg_params, aux_params)
model.fit(train_dataiter,
num_epoch=999999,
eval_data=val_dataiter,
eval_metric=eval_metrics,
kvstore=args.kvstore,
optimizer=opt,
initializer=initializer,
allow_missing=True,
batch_end_callback=_batch_callback,
arg_params=arg_params,
aux_params=aux_params)`
Issue Analytics
- State:
- Created 4 years ago
- Comments:6
Top Results From Across the Web
Transfer Learning | Pretrained Models in Deep Learning
Train some layers while freeze others – Another way to use a pre-trained model is to train is partially. What we can do...
Read more >Transfer learning from pre-trained models | by Pedro Marcelino
4. Transfer learning process · Select a pre-trained model. · Classify your problem according to the Size-Similarity Matrix. In Figure 3 you have...
Read more >How to use a pre-trained deep learning model - Educative.io
Points to consider before moving on to the implementation · Import the required libraries · Load the model · Load the image ·...
Read more >Transfer learning and fine-tuning | TensorFlow Core
A pre-trained model is a saved network that was previously trained on a large dataset, typically on a large-scale image-classification task. You either...
Read more >Using pretrained deep learning model as feature extractor for ...
Code associated with these tutorials can be downloaded from here: https://github.com/bnsreenu/python_for_image_processing_APEER.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @vkasojhaa, I think it’s ok. But the default output of the model with fc7 layer is classification results. I guess it is necessary to get internal layer after load checkpoint for extracting features. see Extract Features in https://github.com/dmlc/mxnet-notebooks/blob/master/python/how_to/predict.ipynb
Hi @vkasojhaa, Generally, we take the output of embedding layer as feature of an image. Then calculate cosine similarity between two features as their similarity.
fc7_weight
is only used while training and validating. It is used for classifying an input image to a certain class. If the person is not in your training set, it impossible to get correct result. That’s why we use cosine similarity.