Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Data Science by (17.6k points)

Hi I'm a newbie to data science, I followed this tutorial https://mxnet.incubator.apache.org/tutorials/nlp/cnn.html but I am confused over how to make a single prediction using the trained model generated by the above mentioned tutorial. Please guide me the right direction to fix this. Thanks.

1 Answer

0 votes
by (41.4k points)

You can load the model as depicted in the following code:

sym, arg_params, aux_params = mx.model.load_checkpoint('cnn',3)

mod = mx.mod.Module(symbol=sym, context=mx.cpu(), label_names=None)

mod.bind(for_training=False, data_shapes=[('data', (1,3,224,224))], label_shapes=mod._label_shapes)

mod.set_params(arg_params, aux_params, allow_missing=True)

Gain practical exposure with data science projects in Intellipaat's Data Science course online.

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

30.5k questions

32.6k answers

500 comments

108k users

Browse Categories

...