You are viewing a plain text version of this content. The canonical link for it is here.
Posted to discuss-archive@mxnet.apache.org by "Nikhil Kr. Parmar via MXNet Forum" <mx...@discoursemail.com.INVALID> on 2020/07/07 12:05:55 UTC

[MXNet Forum] [Gluon] Best way to use multiple trained params on different objects together


Hello Guys,
I am asking a basic 101 question but the thing is we have trained the `faster_rcnn_resnet50_v1b` 2 times on different objects and now my basic code looks like this:

    from gluoncv import model_zoo, data, utils
    from matplotlib import pyplot as plt
    net = model_zoo.get_model('faster_rcnn_resnet50_v1b_voc', pretrained=True, ctx=mx.gpu())
    im_fname = '/home/ubuntu/notebooks/deeplearning_stuff/VOCtemplate/VOC2018/JPEGImages/200425094324_328899_6548_4326.jpg'
    x, img = data.transforms.presets.rcnn.load_test(im_fname, short=512)
    x = x.copyto(mx.gpu())

    print('Shape of pre-processed image:', x.shape)
    net.load_parameters('/home/abc_object/faster_rcnn_resnet50_v1b_voc_best.params')
    net.load_parameters('/home/xyz_weight/faster_rcnn_resnet50_v1b_voc_best.params')
    net.reset_class(['abc_object'], reuse_weights={'abc_object': 'abc_object'})

    class_IDs, scores, bounding_boxs = net(x)

I am having trouble in the net.load_parameters() how can I load two different set of trained weights and perform the prediction??





---
[Visit Topic](https://discuss.mxnet.io/t/best-way-to-use-multiple-trained-params-on-different-objects-together/6385/1) or reply to this email to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.mxnet.io/email/unsubscribe/707f39585bf01dc4d3e29a4042402c5c3f271da9614c84568b3f1bbdb18f044a).

[MXNet Forum] [Gluon] Best way to use multiple trained params on different objects together

Posted by "Nikhil Kr. Parmar via MXNet Forum" <mx...@discoursemail.com.INVALID>.

Hi @feevos anything I am doing wrong?





---
[Visit Topic](https://discuss.mxnet.io/t/best-way-to-use-multiple-trained-params-on-different-objects-together/6385/4) or reply to this email to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.mxnet.io/email/unsubscribe/8bcd24f0b5330e6d2a4f0fad00842bc6ae878f466391461203d74b565af7f3dc).

[MXNet Forum] [Gluon] Best way to use multiple trained params on different objects together

Posted by Foivos Diakogiannis via MXNet Forum <mx...@discoursemail.com.INVALID>.

I am afraid I cannot help further with this.





---
[Visit Topic](https://discuss.mxnet.io/t/best-way-to-use-multiple-trained-params-on-different-objects-together/6385/5) or reply to this email to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.mxnet.io/email/unsubscribe/c74e734f5eb982cfa05906d3b8910d7dc494c8be99f954c0ded12d00a4b704d2).

[MXNet Forum] [Gluon] Best way to use multiple trained params on different objects together

Posted by "Nikhil Kr. Parmar via MXNet Forum" <mx...@discoursemail.com.INVALID>.

Hi @feevos,
Thanks for the reply!
But when I do as you suggested, I get

`AssertionError: Failed loading Parameter 'fasterrcnn6_fasterrcnn6_dense0_weight' from saved params: shape incompatible expected (2, 2048) vs saved (21, 2048)`





---
[Visit Topic](https://discuss.mxnet.io/t/best-way-to-use-multiple-trained-params-on-different-objects-together/6385/3) or reply to this email to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.mxnet.io/email/unsubscribe/db27e98a454a6633c9938afe090841e2efc89b88373f43fb1d5c595dcd1e62fd).

[MXNet Forum] [Gluon] Best way to use multiple trained params on different objects together

Posted by Foivos Diakogiannis via MXNet Forum <mx...@discoursemail.com.INVALID>.

Hi, I am not sure what you are trying to achieve, but you can: 

```
load first -->
do prediction -->
load second-->
do prediction. 
```
like: 
```python
net.load_parameters('/home/abc_object/faster_rcnn_resnet50_v1b_voc_best.params')
class_IDs1, scores1, bounding_boxs1 = net(x)

net.load_parameters('/home/xyz_weight/faster_rcnn_resnet50_v1b_voc_best.params')
class_IDs2, scores2, bounding_boxs2 = net(x)
```





---
[Visit Topic](https://discuss.mxnet.io/t/best-way-to-use-multiple-trained-params-on-different-objects-together/6385/2) or reply to this email to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.mxnet.io/email/unsubscribe/f84d98fc843215734e6e3ee8cd49b2f409dc56aca013e9d07bf130a04abdb632).