@@ -119,13 +119,13 @@ def main_test_layers(model='relu'):
119119 n_batch += 1
120120 print (" val loss: %f" % (val_loss / n_batch ))
121121 print (" val acc: %f" % (val_acc / n_batch ))
122- try :
123- # You can visualize the weight of 1st hidden layer as follow.
124- tl .vis .draw_weights (network .all_params [0 ].eval (), second = 10 , saveable = True , shape = [28 , 28 ], name = 'w1_' + str (epoch + 1 ), fig_idx = 2012 )
125- # You can also save the weight of 1st hidden layer to .npz file.
126- # tl.files.save_npz([network.all_params[0]] , name='w1'+str(epoch+1)+'.npz')
127- except : # pylint: disable=bare-except
128- print ("You should change vis.draw_weights(), if you want to save the feature images for different dataset" )
122+ # try:
123+ # # You can visualize the weight of 1st hidden layer as follow.
124+ # tl.vis.draw_weights(network.all_params[0].eval(), second=10, saveable=True, shape=[28, 28], name='w1_' + str(epoch + 1), fig_idx=2012)
125+ # # You can also save the weight of 1st hidden layer to .npz file.
126+ # # tl.files.save_npz([network.all_params[0]] , name='w1'+str(epoch+1)+'.npz')
127+ # except: # pylint: disable=bare-except
128+ # print("You should change vis.draw_weights(), if you want to save the feature images for different dataset")
129129
130130 print ('Evaluation' )
131131 test_loss , test_acc , n_batch = 0 , 0 , 0
@@ -306,11 +306,11 @@ def main_test_stacked_denoise_AE(model='relu'):
306306 n_batch += 1
307307 print (" val loss: %f" % (val_loss / n_batch ))
308308 print (" val acc: %f" % (val_acc / n_batch ))
309- try :
310- # visualize the 1st hidden layer during fine-tune
311- tl .vis .draw_weights (network .all_params [0 ].eval (), second = 10 , saveable = True , shape = [28 , 28 ], name = 'w1_' + str (epoch + 1 ), fig_idx = 2012 )
312- except : # pylint: disable=bare-except
313- print ("You should change vis.draw_weights(), if you want to save the feature images for different dataset" )
309+ # try:
310+ # # visualize the 1st hidden layer during fine-tune
311+ # tl.vis.draw_weights(network.all_params[0].eval(), second=10, saveable=True, shape=[28, 28], name='w1_' + str(epoch + 1), fig_idx=2012)
312+ # except: # pylint: disable=bare-except
313+ # print("You should change vis.draw_weights(), if you want to save the feature images for different dataset")
314314
315315 print ('Evaluation' )
316316 test_loss , test_acc , n_batch = 0 , 0 , 0
@@ -451,10 +451,10 @@ def main_test_cnn_layer():
451451 n_batch += 1
452452 print (" val loss: %f" % (val_loss / n_batch ))
453453 print (" val acc: %f" % (val_acc / n_batch ))
454- try :
455- tl .vis .CNN2d (network .all_params [0 ].eval (), second = 10 , saveable = True , name = 'cnn1_' + str (epoch + 1 ), fig_idx = 2012 )
456- except : # pylint: disable=bare-except
457- print ("You should change vis.CNN(), if you want to save the feature images for different dataset" )
454+ # try:
455+ # tl.vis.CNN2d(network.all_params[0].eval(), second=10, saveable=True, name='cnn1_' + str(epoch + 1), fig_idx=2012)
456+ # except: # pylint: disable=bare-except
457+ # print("You should change vis.CNN(), if you want to save the feature images for different dataset")
458458
459459 print ('Evaluation' )
460460 test_loss , test_acc , n_batch = 0 , 0 , 0
@@ -474,7 +474,7 @@ def main_test_cnn_layer():
474474 sess = tf .InteractiveSession ()
475475
476476 # Dropout and Dropconnect
477- main_test_layers (model = 'relu' ) # model = relu, dropconnect
477+ # main_test_layers(model='relu') # model = relu, dropconnect
478478
479479 # Single Denoising Autoencoder
480480 # main_test_denoise_AE(model='sigmoid') # model = relu, sigmoid
@@ -483,4 +483,4 @@ def main_test_cnn_layer():
483483 # main_test_stacked_denoise_AE(model='relu') # model = relu, sigmoid
484484
485485 # CNN
486- # main_test_cnn_layer()
486+ main_test_cnn_layer ()
0 commit comments