You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello!! I tried to predict a new CT Image with the code below: The prediction image do generate, but I can't open those in a software like 3D slicer! What type of modifications should be done to the code? I used your covid19.MISCNN repo to train the model. And now for prediction, I used this code:
import miscnn
from miscnn.data_loading.interfaces.nifti_io import NIFTI_interface
import miscnn
import tensorflow as tf
from miscnn.data_loading.interfaces import NIFTI_interface
from miscnn import Data_IO, Preprocessor, Data_Augmentation, Neural_Network
from miscnn.processing.subfunctions import Normalization, Clipping, Resampling
from miscnn.neural_network.architecture.unet.standard import Architecture
from miscnn.neural_network.metrics import tversky_crossentropy, dice_soft,
dice_crossentropy, tversky_loss
#from miscnn.neural_network.model import load
from miscnn.evaluation.cross_validation import cross_validation
from tensorflow.keras.callbacks import ReduceLROnPlateau, TensorBoard,
EarlyStopping, CSVLogger, ModelCheckpoint
from miscnn.evaluation.cross_validation import run_fold, load_disk2fold
from miscnn.neural_network.architecture.unet.standard import Architecture
import argparse
import os
import json
import tensorflow as tf
from miscnn.data_loading.interfaces import NIFTI_interface
from miscnn import Data_IO
from miscnn.evaluation.cross_validation import split_folds
Hello!! I tried to predict a new CT Image with the code below: The prediction image do generate, but I can't open those in a software like 3D slicer! What type of modifications should be done to the code? I used your covid19.MISCNN repo to train the model. And now for prediction, I used this code:
import miscnn
from miscnn.data_loading.interfaces.nifti_io import NIFTI_interface
import miscnn
import tensorflow as tf
from miscnn.data_loading.interfaces import NIFTI_interface
from miscnn import Data_IO, Preprocessor, Data_Augmentation, Neural_Network
from miscnn.processing.subfunctions import Normalization, Clipping, Resampling
from miscnn.neural_network.architecture.unet.standard import Architecture
from miscnn.neural_network.metrics import tversky_crossentropy, dice_soft,
dice_crossentropy, tversky_loss
#from miscnn.neural_network.model import load
from miscnn.evaluation.cross_validation import cross_validation
from tensorflow.keras.callbacks import ReduceLROnPlateau, TensorBoard,
EarlyStopping, CSVLogger, ModelCheckpoint
from miscnn.evaluation.cross_validation import run_fold, load_disk2fold
from miscnn.neural_network.architecture.unet.standard import Architecture
import argparse
import os
import json
import tensorflow as tf
from miscnn.data_loading.interfaces import NIFTI_interface
from miscnn import Data_IO
from miscnn.evaluation.cross_validation import split_folds
interface = NIFTI_interface(channels=1, classes=2)
data_path = "dataset"
data_io = miscnn.Data_IO(interface, data_path)
sample_list = data_io.get_indiceslist()
sample_list.sort()
sf_clipping = Clipping(min=-1250, max=250)
sf_normalize = Normalization(mode="grayscale")
sf_resample = Resampling((1.58, 1.58, 2.70))
sf_zscore = Normalization(mode="z-score")
sf = [sf_clipping, sf_normalize, sf_resample, sf_zscore]
pp = Preprocessor(data_io, batch_size=2, subfunctions=sf,
prepare_subfunctions=True, prepare_batches=False,
analysis="patchwise-crop", patch_shape=(160, 160, 80))
pp.patchwise_overlap = (80, 80, 30)
unet_standard = Architecture(depth=4, activation="softmax",
batch_normalization=True)
model = Neural_Network(preprocessor=pp, architecture=unet_standard,
loss=tversky_crossentropy,
metrics=[tversky_loss, dice_soft, dice_crossentropy],
batch_queue_size=3, workers=3, learninig_rate=0.001)
model.load("/data/covid19.MIScnn/runs/model.best.hdf5",custom_objects={'tversky_crossentropy':
tversky_crossentropy,'tversky_loss':tversky_loss,'dice_soft':dice_soft,'dice_crossentropy':dice_crossentropy})
model.predict(sample_list,return_output=False)
Here is a sample Predicted CT Image File;
volume-covid19-A-0679_ct.nii.gz
The text was updated successfully, but these errors were encountered: