質問編集履歴
2
プログラムの変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -11,36 +11,6 @@
|
|
11
11
|
もし可能性として考えられるものがありましたら、教えていただきたいです。よろしくお願いいたします。
|
12
12
|
|
13
13
|
``` python
|
14
|
-
|
15
|
-
import numpy as np
|
16
|
-
|
17
|
-
import cupy as cp
|
18
|
-
|
19
|
-
import os
|
20
|
-
|
21
|
-
import time
|
22
|
-
|
23
|
-
import cv2
|
24
|
-
|
25
|
-
import json
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
import chainer
|
30
|
-
|
31
|
-
import chainer.functions as F
|
32
|
-
|
33
|
-
import chainer.links as L
|
34
|
-
|
35
|
-
from chainer import cuda
|
36
|
-
|
37
|
-
from chainer import Variable
|
38
|
-
|
39
|
-
from u_net import UNET
|
40
|
-
|
41
|
-
import data
|
42
|
-
|
43
|
-
|
44
14
|
|
45
15
|
|
46
16
|
|
@@ -82,7 +52,7 @@
|
|
82
52
|
|
83
53
|
h = net(x)
|
84
54
|
|
85
|
-
loss =
|
55
|
+
loss = *****
|
86
56
|
|
87
57
|
net.cleargrads()
|
88
58
|
|
@@ -95,44 +65,6 @@
|
|
95
65
|
print('{0:5} {1:7.1f} {2:.6f}'.format(ep, time.clock()-stime, float(train_loss_sum)/ites)
|
96
66
|
|
97
67
|
chainer.serializers.save_npz('{}_{}'.format(modelname, ep), net)
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
if __name__ == '__main__':
|
102
|
-
|
103
|
-
parser = argparse.ArgumentParser(description='UNET', add_help=True)
|
104
|
-
|
105
|
-
parser.add_argument('--batchsize', '-b', type=int, default=8,
|
106
|
-
|
107
|
-
help='batchsize')
|
108
|
-
|
109
|
-
parser.add_argument('--gpu', '-g', type=int, default=0,
|
110
|
-
|
111
|
-
help='GPUID')
|
112
|
-
|
113
|
-
parser.add_argument('--epoch', '-e', type=int, default=300,
|
114
|
-
|
115
|
-
help='epoch')
|
116
|
-
|
117
|
-
parser.add_argument('--iteration', '-i', type=int, default=100,
|
118
|
-
|
119
|
-
help='iteration')
|
120
|
-
|
121
|
-
parser.add_argument('--trainfolder', '-trf', type=str, default='./train/',
|
122
|
-
|
123
|
-
help='trainfolder')
|
124
|
-
|
125
|
-
parser.add_argument('--trainlabel', '-trl', type=str, default='./train-label/',
|
126
|
-
|
127
|
-
help='trainlabelfolder')
|
128
|
-
|
129
|
-
parser.add_argument('--modelname', '-m', type=str, default='./model/model',
|
130
|
-
|
131
|
-
help='modelfolder')
|
132
|
-
|
133
|
-
args = parser.parse_args()
|
134
|
-
|
135
|
-
main(args.gpu, args.epoch, args.iteration, args.batchsize, args.trainfolder, args.trainlabel, args.modelname)
|
136
68
|
|
137
69
|
|
138
70
|
|
1
不要なパラメータの削除
test
CHANGED
File without changes
|
test
CHANGED
@@ -44,7 +44,7 @@
|
|
44
44
|
|
45
45
|
|
46
46
|
|
47
|
-
def main(gpu, epoch, ites, bsize, trfolder, trlabel, modelname
|
47
|
+
def main(gpu, epoch, ites, bsize, trfolder, trlabel, modelname):
|
48
48
|
|
49
49
|
chainer.cuda.get_device(gpu).use()
|
50
50
|
|
@@ -130,17 +130,9 @@
|
|
130
130
|
|
131
131
|
help='modelfolder')
|
132
132
|
|
133
|
-
parser.add_argument('--fnweight', '-fn', type=float, default=1,
|
134
|
-
|
135
|
-
help='FN')
|
136
|
-
|
137
|
-
parser.add_argument('--fpweight', '-fp', type=float, default=1,
|
138
|
-
|
139
|
-
help='FP')
|
140
|
-
|
141
133
|
args = parser.parse_args()
|
142
134
|
|
143
|
-
main(args.gpu, args.epoch, args.iteration, args.batchsize, args.trainfolder, args.trainlabel, args.modelname
|
135
|
+
main(args.gpu, args.epoch, args.iteration, args.batchsize, args.trainfolder, args.trainlabel, args.modelname)
|
144
136
|
|
145
137
|
|
146
138
|
|