Search in sources :

Example 1 with FunctionLinear_F32

use of deepboof.impl.forward.standard.FunctionLinear_F32 in project BoofCV by lessthanoptimal.

the class CheckBaseImageClassifier method createDummyNetwork.

private void createDummyNetwork(BaseImageClassifier alg, int width, int height) {
    for (int i = 0; i < numCategories; i++) {
        alg.getCategories().add("Category " + i);
    }
    FunctionLinear_F32 function = new FunctionLinear_F32(numCategories);
    function.initialize(3, height, width);
    List<Tensor_F32> parameters = new ArrayList<>();
    parameters.add(TensorFactory_F32.random(rand, false, function.getParameterShapes().get(0)));
    parameters.add(TensorFactory_F32.random(rand, false, function.getParameterShapes().get(1)));
    function.setParameters(parameters);
    Node<Tensor_F32, Function<Tensor_F32>> node = new Node<>();
    node.function = function;
    List<Node<Tensor_F32, Function<Tensor_F32>>> sequence = new ArrayList<>();
    sequence.add(node);
    alg.network = new FunctionSequence<>(sequence, Tensor_F32.class);
    alg.tensorOutput = new Tensor_F32(WI(1, alg.network.getOutputShape()));
}
Also used : Function(deepboof.Function) FunctionLinear_F32(deepboof.impl.forward.standard.FunctionLinear_F32) Node(deepboof.graph.Node) ArrayList(java.util.ArrayList) Tensor_F32(deepboof.tensors.Tensor_F32)

Aggregations

Function (deepboof.Function)1 Node (deepboof.graph.Node)1 FunctionLinear_F32 (deepboof.impl.forward.standard.FunctionLinear_F32)1 Tensor_F32 (deepboof.tensors.Tensor_F32)1 ArrayList (java.util.ArrayList)1