Package boofcv.deepboof
Class ImageClassifierResNet
java.lang.Object
boofcv.deepboof.BaseImageClassifier
boofcv.deepboof.ImageClassifierResNet
- All Implemented Interfaces:
ImageClassifier<Planar<GrayF32>>
,ImageModelBase<Planar<GrayF32>>
1) Look at Torch source code
a) Determine the shape of the input tensor. That will be used to set imageSize
b) Figure out how it normalizes the input. Are normalization parameters stored in the network?
2) Load model and inspect in a debugger
List list = new ParseBinaryTorch7().parse(new File(path,name));
3) Hopefully no problem loading the target object.
4) Your goal now is to figure out where the network is stored. Inspect the Lua code and the returned object
There is no standard format. For
5) For resnet-18.t7 the first element in the list is the start of the network
TorchGeneric torchSequence = (TorchGeneric)list.get(0);
6) Convert it into a DeepBoof network. Cross your fingers and hope that all the layers are supported.
7) An exception is thrown and it says something isn't support or it just crashes with a weird message
MO**** F***** it's not supported. Contact Peter and hope there's an easy fix or get ready to make a code contribution to DeepBoof
8) You got lucky and no error messages!!!
-
Nested Class Summary
Nested classes/interfaces inherited from interface boofcv.abst.scene.ImageClassifier
ImageClassifier.Score
-
Field Summary
Fields inherited from class boofcv.deepboof.BaseImageClassifier
categories, categoryBest, categoryScores, imageRgb, imageSize, imageType, massage, network, tensorInput, tensorOutput
-
Constructor Summary
-
Method Summary
Methods inherited from class boofcv.deepboof.BaseImageClassifier
classify, getAllResults, getBestResult, getCategories, getImageRgb, getInputType, innerProcess, preprocess
-
Constructor Details
-
ImageClassifierResNet
public ImageClassifierResNet(int resnetID)
-
-
Method Details
-
loadModel
Description copied from interface:ImageModelBase
Loads the model at the specified location. See documentation of the classifier for what needs to be passed in here.- Parameters:
path
- Path to directory or file containing the model- Throws:
IOException
-