[1bd6b2]: / BraTs18Challege / train_Brats.py

Download this file

34 lines (25 with data), 991 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import os
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())
from Vnet.model_vnet3d import Vnet3dModule
import numpy as np
import pandas as pd
def train():
'''
Vnet network segmentation kidney fine segmatation
Preprocessing for dataset
'''
# Read data set (Train data from CSV file)
csvdata = pd.read_csv('dataprocess\\data/train.csv')
maskdata = csvdata.iloc[:, 1].values
imagedata = csvdata.iloc[:, 0].values
# shuffle imagedata and maskdata together
perm = np.arange(len(imagedata))
np.random.shuffle(perm)
imagedata = imagedata[perm]
maskdata = maskdata[perm]
Vnet3d = Vnet3dModule(128, 128, 64, channels=4, numclass=3, costname=("dice coefficient",))
Vnet3d.train(imagedata, maskdata, "Vnet3d.pd", "log\\segmeation\\VNet\\", 0.001, 0.5, 20, 1, [8, 8])
train()