Search in sources :

Example 6 with BorderType

use of boofcv.core.image.border.BorderType in project BoofCV by lessthanoptimal.

the class ImageClassifierVggCifar10 method loadModel.

/**
 * Expects there to be two files in the provided directory:<br>
 * YuvStatistics.txt<br>
 * model.net<br>
 *
 * @param directory Directory containing model files
 * @throws IOException Throw if anything goes wrong while reading data
 */
@Override
public void loadModel(File directory) throws IOException {
    stats = DeepModelIO.load(new File(directory, "YuvStatistics.txt"));
    SequenceAndParameters<Tensor_F32, Function<Tensor_F32>> sequence = new ParseBinaryTorch7().parseIntoBoof(new File(directory, "model.net"));
    network = sequence.createForward(3, inputSize, inputSize);
    tensorOutput = new Tensor_F32(WI(1, network.getOutputShape()));
    BorderType type = BorderType.valueOf(stats.border);
    localNorm = new ImageLocalNormalization<>(GrayF32.class, type);
    kernel = DataManipulationOps.create1D_F32(stats.kernel);
}
Also used : Function(deepboof.Function) GrayF32(boofcv.struct.image.GrayF32) ParseBinaryTorch7(deepboof.io.torch7.ParseBinaryTorch7) Tensor_F32(deepboof.tensors.Tensor_F32) File(java.io.File) BorderType(boofcv.core.image.border.BorderType)

Aggregations

BorderType (boofcv.core.image.border.BorderType)6 Test (org.junit.Test)4 WlCoef_F32 (boofcv.struct.wavelet.WlCoef_F32)2 WlCoef_I32 (boofcv.struct.wavelet.WlCoef_I32)2 GrayF32 (boofcv.struct.image.GrayF32)1 ImageGray (boofcv.struct.image.ImageGray)1 Function (deepboof.Function)1 ParseBinaryTorch7 (deepboof.io.torch7.ParseBinaryTorch7)1 Tensor_F32 (deepboof.tensors.Tensor_F32)1 File (java.io.File)1