How to use the miscnn.Neural_Network function in miscnn

To help you get started, we’ve selected a few miscnn examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github frankkramer-lab / MIScnn / tests / test_neuralnetwork.py View on Github external
def test_MODEL_prediction2D(self):
        nn = Neural_Network(preprocessor=self.pp2D)
        nn.predict(self.sample_list2D)
        for index in self.sample_list2D:
            sample = self.data_io2D.sample_loader(index, load_seg=True,
                                                  load_pred=True)
            self.assertIsNotNone(sample.pred_data)
github frankkramer-lab / MIScnn / tests / test_neuralnetwork.py View on Github external
def test_MODEL_prediction_activationOutput(self):
        nn = Neural_Network(preprocessor=self.pp2D)
        pred_list = nn.predict(self.sample_list2D, return_output=True,
                               activation_output=True)
        for pred in pred_list:
            self.assertIsNotNone(pred)
            self.assertEqual(pred.shape, (16,16,3))
github frankkramer-lab / MIScnn / tests / test_neuralnetwork.py View on Github external
def test_MODEL_create(self):
        nn2D = Neural_Network(preprocessor=self.pp2D)
        self.assertIsInstance(nn2D, Neural_Network)
        self.assertFalse(nn2D.three_dim)
        self.assertIsNotNone(nn2D.model)
        nn3D = Neural_Network(preprocessor=self.pp3D)
        self.assertIsInstance(nn3D, Neural_Network)
        self.assertTrue(nn3D.three_dim)
        self.assertIsNotNone(nn3D.model)
github frankkramer-lab / MIScnn / tests / test_neuralnetwork.py View on Github external
def test_MODEL_create(self):
        nn2D = Neural_Network(preprocessor=self.pp2D)
        self.assertIsInstance(nn2D, Neural_Network)
        self.assertFalse(nn2D.three_dim)
        self.assertIsNotNone(nn2D.model)
        nn3D = Neural_Network(preprocessor=self.pp3D)
        self.assertIsInstance(nn3D, Neural_Network)
        self.assertTrue(nn3D.three_dim)
        self.assertIsNotNone(nn3D.model)
github frankkramer-lab / MIScnn / tests / test_neuralnetwork.py View on Github external
def test_MODEL_validation3D(self):
        nn = Neural_Network(preprocessor=self.pp3D)
        history = nn.evaluate(self.sample_list3D[0:4], self.sample_list3D[4:6],
                              epochs=3)
        self.assertIsNotNone(history)
github frankkramer-lab / MIScnn / tests / test_evaluations.py View on Github external
# Initialize Dictionary IO Interface
        io_interface = Dictionary_interface(self.dataset, classes=3,
                                              three_dim=False)
        # Initialize temporary directory
        self.tmp_dir = tempfile.TemporaryDirectory(prefix="tmp.miscnn.")
        tmp_batches = os.path.join(self.tmp_dir.name, "batches")
        # Initialize Data IO
        self.data_io = Data_IO(io_interface,
                               input_path=os.path.join(self.tmp_dir.name),
                               output_path=os.path.join(self.tmp_dir.name),
                               batch_path=tmp_batches, delete_batchDir=False)
        # Initialize Preprocessor
        self.pp = Preprocessor(self.data_io, batch_size=2,
                               data_aug=None, analysis="fullimage")
        # Initialize Neural Network
        self.model = Neural_Network(self.pp)
        # Get sample list
        self.sample_list = self.data_io.get_indiceslist()
github frankkramer-lab / MIScnn / tests / test_neuralnetwork.py View on Github external
def test_MODEL_prediction3D(self):
        nn = Neural_Network(preprocessor=self.pp3D)
        nn.predict(self.sample_list3D)
        for index in self.sample_list3D:
            sample = self.data_io3D.sample_loader(index, load_seg=True,
                                                  load_pred=True)
            self.assertIsNotNone(sample.pred_data)
github frankkramer-lab / MIScnn / tests / test_neuralnetwork.py View on Github external
def test_MODEL_loading(self):
        nn = Neural_Network(preprocessor=self.pp3D)
        model_path = os.path.join(self.tmp_dir3D.name, "my_model.hdf5")
        nn.dump(model_path)
        nn_new = Neural_Network(preprocessor=self.pp3D)
        nn_new.load(model_path)
github frankkramer-lab / MIScnn / tests / test_neuralnetwork.py View on Github external
def test_MODEL_resetWeights(self):
        nn = Neural_Network(preprocessor=self.pp3D)
        nn.reset_weights()