-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathvnet2d_train.py
48 lines (37 loc) · 1.41 KB
/
vnet2d_train.py
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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 Vnet2d.vnet_model import Vnet2dModule, AGVnet2dModule
import numpy as np
import pandas as pd
def train():
'''
Preprocessing for dataset
'''
# Read data set (Train data from CSV file)
csvdata = pd.read_csv('dataprocess\segandclassifydata.csv')
trainData = csvdata.iloc[:, :].values
np.random.shuffle(trainData)
labeldata = trainData[:, 0]
imagedata = trainData[:, 1]
maskdata = trainData[:, 2]
Vnet2d = Vnet2dModule(512, 512, channels=1, costname="dice coefficient")
Vnet2d.train(imagedata, maskdata, "Vnet2d.pd", "log\\segmeation\\vnet2d\\", 0.001, 0.5, 10, 6)
def trainag():
'''
Preprocessing for dataset
'''
# Read data set (Train data from CSV file)
csvdata = pd.read_csv('dataprocess\segandclassifydata.csv')
trainData = csvdata.iloc[:, :].values
np.random.shuffle(trainData)
labeldata = trainData[:, 0]
imagedata = trainData[:, 1]
maskdata = trainData[:, 2]
agVnet2d = AGVnet2dModule(512, 512, channels=1, costname="dice coefficient")
agVnet2d.train(imagedata, maskdata, "agVnet2d.pd", "log\\segmeation\\agvnet2d\\", 0.001, 0.5, 10, 5)
if __name__ == '__main__':
train()
print('success')