diff --git a/util.py b/util.py new file mode 100644 index 0000000..7dd5f8a --- /dev/null +++ b/util.py @@ -0,0 +1,34 @@ +import matplotlib.pyplot as plt +train_parameters={ + "input_size":[3,244,244], + "class_dim":-1, + 'target_path':"./data_set", + "train_list_path":'./train.txt', + 'eval_list_path':'./eval.txt', + "readme_path": "./readme.json", + 'label_dict':{'0': 'maskimages', '1': 'nomaskimages'}, + "train_batch_size": 8, + 'num_epochs':1, + "learning_stategry":{ + 'lr':0.001 + } +} + +def draw_train_process(title,iters,cost,accs,label_cost,label_acc): + plt.title(title,fontsize=24) + plt.xlabel('iter',fontsize=20) + plt.ylabel('cost/acc',fontsize=20) + plt.plot(iters,cost,color='red',label=label_cost) + plt.plot(iters,accs,color='green',label=label_acc) + plt.legend() + plt.grid() + plt.show() + +def draw_process(title,color,iters,data,label): + plt.title(title, fontsize=24) + plt.xlabel("iter", fontsize=20) + plt.ylabel(label, fontsize=20) + plt.plot(iters, data,color=color,label=label) + plt.legend() + plt.grid() + plt.show() \ No newline at end of file