From 04bb2566fc4a0911ba1be4ccf480da44ce212d6d Mon Sep 17 00:00:00 2001 From: pyhqos7bg Date: Thu, 30 May 2024 15:18:46 +0800 Subject: [PATCH] ADD file via upload --- util.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 util.py 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