@@ -33,12 +33,11 @@ def scheduler(epoch):
3333def color_preprocessing (x_train ,x_test ):
3434 x_train = x_train .astype ('float32' )
3535 x_test = x_test .astype ('float32' )
36- x_train [:,:,:,0 ] = (x_train [:,:,:,0 ] - np .mean (x_train [:,:,:,0 ])) / np .std (x_train [:,:,:,0 ])
37- x_train [:,:,:,1 ] = (x_train [:,:,:,1 ] - np .mean (x_train [:,:,:,1 ])) / np .std (x_train [:,:,:,1 ])
38- x_train [:,:,:,2 ] = (x_train [:,:,:,2 ] - np .mean (x_train [:,:,:,2 ])) / np .std (x_train [:,:,:,2 ])
39- x_test [:,:,:,0 ] = (x_test [:,:,:,0 ] - np .mean (x_test [:,:,:,0 ])) / np .std (x_test [:,:,:,0 ])
40- x_test [:,:,:,1 ] = (x_test [:,:,:,1 ] - np .mean (x_test [:,:,:,1 ])) / np .std (x_test [:,:,:,1 ])
41- x_test [:,:,:,2 ] = (x_test [:,:,:,2 ] - np .mean (x_test [:,:,:,2 ])) / np .std (x_test [:,:,:,2 ])
36+ mean = [125.307 , 122.95 , 113.865 ]
37+ std = [62.9932 , 62.0887 , 66.7048 ]
38+ for i in range (3 ):
39+ x_train [:,:,:,i ] = (x_train [:,:,:,i ] - mean [i ]) / std [i ]
40+ x_test [:,:,:,i ] = (x_test [:,:,:,i ] - mean [i ]) / std [i ]
4241
4342 return x_train , x_test
4443
@@ -127,4 +126,4 @@ def wide_residual_layer(x,out_filters,increase_filter=False):
127126 epochs = epochs ,
128127 callbacks = cbks ,
129128 validation_data = (x_test , y_test ))
130- resnet .save ('resnet.h5' )
129+ resnet .save ('resnet.h5' )
0 commit comments