All Downloads are FREE. Search and download functionalities are using the official Maven repository.

examples.0.4.source-code.ExampleVisualizeNetwork Maven / Gradle / Ivy

There is a newer version: 0.5
Show newest version
import deepboof.Function;
import deepboof.datasets.UtilCifar10;
import deepboof.graph.FunctionSequence;
import deepboof.io.torch7.ParseBinaryTorch7;
import deepboof.io.torch7.SequenceAndParameters;
import deepboof.tensors.Tensor_F32;
import deepboof.visualization.DeepVisulization;
import deepboof.visualization.SequentialNetworkDisplay;

import javax.swing.*;
import java.awt.*;
import java.io.File;
import java.io.IOException;
import java.util.List;

/**
 * @author Peter Abeles
 */
public class ExampleVisualizeNetwork {
	public static void main(String[] args) throws IOException {
		File modelHome = UtilCifar10.downloadModelVggLike(new File("data/torch_models"));

		System.out.println("Load and convert to DeepBoof");
		SequenceAndParameters> sequence =
				new ParseBinaryTorch7().parseIntoBoof(new File(modelHome,"model.net"));

		FunctionSequence> network = sequence.createForward(3,32,32);

		SequentialNetworkDisplay gui = new SequentialNetworkDisplay((List)network.getSequence());

		JScrollPane scrollPane = new JScrollPane(gui);
		scrollPane.setPreferredSize(new Dimension(400,800));

		DeepVisulization.showWindow(scrollPane,"Network",true);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy