Saving loss-chart for each 100 iterations automatically

This commit is contained in:
AlexeyAB
2018-11-26 11:11:56 +03:00
parent 9f7d7c58b5
commit 21a4ec9390
2 changed files with 3 additions and 2 deletions

View File

@ -716,7 +716,8 @@ void update_convolutional_layer_gpu(convolutional_layer layer, int batch, float
// = weights_new*(1 - decay*lr) - weights_old*momentum*decay*lr + (weights_update_new + weights_update_old*momentum)*lr/batch // = weights_new*(1 - decay*lr) - weights_old*momentum*decay*lr + (weights_update_new + weights_update_old*momentum)*lr/batch
//------------- RESULT -------------- //------------- RESULT --------------
// weights_newest = weights_new*(1 - decay*lr) - weights_old*momentum*(decay*lr) + (weights_update_new + weights_update_old*momentum)*lr/batch // weights_newest = weights_new*(1 - decay*lr) - weights_old*momentum*(decay*lr) + (weights_update_new + weights_update_old*momentum)*lr/batch =
// = weights_new - (weights_new + weights_old*momentum)*decay*lr + (weights_update_new + weights_update_old*momentum)*lr / batch
//----------------------------------- //-----------------------------------
} }
} }

View File

@ -739,7 +739,7 @@ void draw_train_loss(IplImage* img, int img_size, float avg_loss, float max_img_
cvPutText(img, char_buff, pt1, &font, CV_RGB(0, 0, 0)); cvPutText(img, char_buff, pt1, &font, CV_RGB(0, 0, 0));
cvShowImage("average loss", img); cvShowImage("average loss", img);
int k = cvWaitKey(20); int k = cvWaitKey(20);
if (k == 's' || current_batch == (max_batches - 1)) { if (k == 's' || current_batch == (max_batches - 1) || current_batch % 100 == 0) {
cvSaveImage("chart.jpg", img, 0); cvSaveImage("chart.jpg", img, 0);
cvPutText(img, "- Saved", cvPoint(250, img_size - 10), &font, CV_RGB(255, 0, 0)); cvPutText(img, "- Saved", cvPoint(250, img_size - 10), &font, CV_RGB(255, 0, 0));
} }