@@ -2,8 +2,13 @@ changes from https://github.com/wizyoung/YOLOv3_TensorFlow
by Seongju Kim, kareus1@khu.ac.kr
I only tested in colab environment yet (2020.05.16),
so let me know if there are some errors/problems in python code version
(##last changed: 2020.05.16)
1] changed TextLineDataset to TFRecordDataset. (also changed data parsing in data utils and eval utils)
2] fixed restore-does-not-exist problem in train/eval mode
3] fixed saver to save the parameter only when save-optimizer option is true
4] changed parameter 'mode' to bool value 'is_training' in data util functions (string value 'mode' is passed as byte string, so functions do not evaluate if-clauses as expected. ex) 'train' != b'train')
5] wrote TFRecord binary iterator, which runs without tf session (references: https://github.com/pgmmpk/tfrecord )
6] removed logging/tenorboard summary code. (I will add it later if necessary)
assertlen(boxes)%5==0,'Annotation error occured in box array.'
box_cnt=len(boxes)//5
...
...
@@ -33,7 +31,7 @@ def parse_tfrecord(data):
labels=[]
foriinrange(box_cnt):
label,x_min,y_min,x_max,y_max=int(boxes[i*5]),float(boxes[i*5+1]),float(boxes[i*5+2]),float(boxes[i*5+3])## do we need to change int to float? is there float rectangle sample?
label,x_min,y_min,x_max,y_max=int(boxes[i*5]),float(boxes[i*5+1]),float(boxes[i*5+2]),float(boxes[i*5+3]),float(boxes[i*5+4])## do we need to change int to float? is there float rectangle sample?
"# Choose the parts you want to finetune. List form.\n",
"# Set to None to train the whole model.\n",
"\n",
"update_part = ['yolov3/yolov3_head']\n",
"\n",
"### other training strategies\n",
"multi_scale_train = True # Whether to apply multi-scale training strategy. Image size varies from [320, 320] to [640, 640] by default.\n",
"use_label_smooth = True # Whether to use class label smoothing strategy.\n",
"use_focal_loss = True # Whether to apply focal loss on the conf loss.\n",
"use_mix_up = True # Whether to use mix up data augmentation strategy. \n",
"use_warm_up = True # whether to use warm up strategy to prevent from gradient exploding.\n",
"warm_up_epoch = 2 # Warm up training epoches. Set to a larger value if gradient explodes.\n",
"\n",
"### some constants in validation\n",
"# nms\n",
"nms_threshold = 0.45 # iou threshold in nms operation\n",
"score_threshold = 0.01 # threshold of the probability of the classes in nms operation, i.e. score = pred_confs * pred_probs. set lower for higher recall.\n",
"nms_topk = 150 # keep at most nms_topk outputs after nms\n",
"# mAP eval\n",
"eval_threshold = 0.5 # the iou threshold applied in mAP evaluation\n",
"use_voc_07_metric = False # whether to use voc 2007 evaluation metric, i.e. the 11-point metric\n",
"pw_boundaries = [float(i) * train_batch_num + current_global_step for i in pw_boundaries]\n"
],
"execution_count":9,
"outputs":[
{
"output_type":"stream",
"text":[
"WARNING:tensorflow:From <ipython-input-2-ea7f0591b13c>:7: tf_record_iterator (from tensorflow.python.lib.io.tf_record) is deprecated and will be removed in a future version.\n",