-
Notifications
You must be signed in to change notification settings - Fork 0
/
fmisr_train.py
executable file
·39 lines (25 loc) · 937 Bytes
/
fmisr_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
from __future__ import print_function, division, absolute_import, unicode_literals
import os
import shutil
import numpy as np
import logging
import tensorflow as tf
from tf_dcsrn import dcsrn, image_util
#script for training step
output_path = "./snapshots/test"
# path of dataset, here is the HCP dataset
dataset_HCP = "Train"
#preparing data loading, you may want to explicitly note the glob search path on you data
data_provider = image_util.MedicalImageDataProvider()
print("\ndata_provider initialization over.\n")
# setup & training
net = dcsrn.DCSRN(channels=3)
print("\nGraph set over.\n")
trainer = dcsrn.Trainer(net)
print("\nBegin to train.\n")
path = trainer.train(data_provider, output_path, restore = True)
print("\nTraining process is over.\n")
# verification, randomly test 4 images
test_provider = image_util.MedicalImageDataProvider()
test_x, test_y = test_provider(4)
result = net.predict(path, test_x)