Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- net = models.squeezenet1_1(pretrained=True, prefix='deep_dog_', ctx=contexts)
- # hot dog happens to be a class in imagenet.
- # we can reuse the weight for that class for better performance
- # here's the index for that class for later use
- imagenet_hotdog_index = 713
- deep_dog_net = models.squeezenet1_1(prefix='deep_dog_', classes=2)
- deep_dog_net.collect_params().initialize(ctx=contexts)
- deep_dog_net.features = net.features
- print(deep_dog_net)
- out = mx.nd.SoftmaxActivation(net(image.as_in_context(contexts[0])))
- print('Probabilities are: '+str(out[0].asnumpy()))
- result = np.argmax(out.asnumpy())
- if np.argmax(out.asnumpy()) == 713:
- "Hot Dog!'
- Else:
- "Not hot dog!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement