X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=example-apps%2FPDD%2Fpcb-defect-detection%2Flibs%2Fconfigs%2Fcfgs_res101_fpn_v1.py;fp=example-apps%2FPDD%2Fpcb-defect-detection%2Flibs%2Fconfigs%2Fcfgs_res101_fpn_v1.py;h=15b95f1efda69ed7da06fdf72ff9651694eb6fd6;hb=a785567fb9acfc68536767d20f60ba917ae85aa1;hp=0000000000000000000000000000000000000000;hpb=94a133e696b9b2a7f73544462c2714986fa7ab4a;p=ealt-edge.git diff --git a/example-apps/PDD/pcb-defect-detection/libs/configs/cfgs_res101_fpn_v1.py b/example-apps/PDD/pcb-defect-detection/libs/configs/cfgs_res101_fpn_v1.py new file mode 100755 index 0000000..15b95f1 --- /dev/null +++ b/example-apps/PDD/pcb-defect-detection/libs/configs/cfgs_res101_fpn_v1.py @@ -0,0 +1,125 @@ +# -*- coding: utf-8 -*- +from __future__ import division, print_function, absolute_import +import os +import tensorflow as tf +''' + +''' + +# ------------------------------------------------ +VERSION = 'FPN_Res101_20181201_v1' +NET_NAME = 'resnet_v1_101' +ADD_BOX_IN_TENSORBOARD = True + +# ---------------------------------------- System_config +ROOT_PATH = os.path.abspath('../') +print (20*"++--") +print (ROOT_PATH) +GPU_GROUP = "2" +SHOW_TRAIN_INFO_INTE = 10 +SMRY_ITER = 100 +SAVE_WEIGHTS_INTE = 10000 + +SUMMARY_PATH = ROOT_PATH + '/output/summary' +TEST_SAVE_PATH = ROOT_PATH + '/tools/test_result' +INFERENCE_IMAGE_PATH = ROOT_PATH + '/tools/inference_image' +INFERENCE_SAVE_PATH = ROOT_PATH + '/tools/inference_results' + +if NET_NAME.startswith("resnet"): + weights_name = NET_NAME +elif NET_NAME.startswith("MobilenetV2"): + weights_name = "mobilenet/mobilenet_v2_1.0_224" +else: + raise NotImplementedError + +PRETRAINED_CKPT = ROOT_PATH + '/data/pretrained_weights/' + weights_name + '.ckpt' +TRAINED_CKPT = os.path.join(ROOT_PATH, 'output/trained_weights') + +EVALUATE_DIR = ROOT_PATH + '/output/evaluate_result_pickle/' +test_annotate_path = '/home/yjr/DataSet/VOC/VOC_test/VOC2007/Annotations' + +# ------------------------------------------ Train config +RESTORE_FROM_RPN = False +IS_FILTER_OUTSIDE_BOXES = False +FIXED_BLOCKS = 0 # allow 0~3 +USE_07_METRIC = False + +RPN_LOCATION_LOSS_WEIGHT = 1. +RPN_CLASSIFICATION_LOSS_WEIGHT = 1.0 + +FAST_RCNN_LOCATION_LOSS_WEIGHT = 1.0 +FAST_RCNN_CLASSIFICATION_LOSS_WEIGHT = 1.0 +RPN_SIGMA = 3.0 +FASTRCNN_SIGMA = 1.0 + +MUTILPY_BIAS_GRADIENT = None # 2.0 # if None, will not multipy +GRADIENT_CLIPPING_BY_NORM = None # 10.0 if None, will not clip + +EPSILON = 1e-5 +MOMENTUM = 0.9 +LR = 0.001 # 0.001 # 0.0003 +DECAY_STEP = [60000, 80000] # 50000, 70000 +MAX_ITERATION = 150000 + +# -------------------------------------------- Data_preprocess_config +DATASET_NAME = 'pascal' # 'ship', 'spacenet', 'pascal', 'coco' +PIXEL_MEAN = [123.68, 116.779, 103.939] # R, G, B. In tf, channel is RGB. In openCV, channel is BGR +IMG_SHORT_SIDE_LEN = 800 # 600 # 600 +IMG_MAX_LENGTH = 1200 # 1000 # 1000 +CLASS_NUM = 20 + +# --------------------------------------------- Network_config +BATCH_SIZE = 1 +INITIALIZER = tf.random_normal_initializer(mean=0.0, stddev=0.01) +BBOX_INITIALIZER = tf.random_normal_initializer(mean=0.0, stddev=0.001) +WEIGHT_DECAY = 0.00004 if NET_NAME.startswith('Mobilenet') else 0.0001 + +# ---------------------------------------------Anchor config +USE_CENTER_OFFSET = False + +LEVLES = ['P2', 'P3', 'P4', 'P5', 'P6'] +BASE_ANCHOR_SIZE_LIST = [32, 64, 128, 256, 512] # addjust the base anchor size for voc. +ANCHOR_STRIDE_LIST = [4, 8, 16, 32, 64] +ANCHOR_SCALES = [1.0] +ANCHOR_RATIOS = [0.5, 1., 2.0] +ROI_SCALE_FACTORS = [10., 10., 5.0, 5.0] +ANCHOR_SCALE_FACTORS = None + +# --------------------------------------------FPN config +SHARE_HEADS = True +KERNEL_SIZE = 3 +RPN_IOU_POSITIVE_THRESHOLD = 0.7 +RPN_IOU_NEGATIVE_THRESHOLD = 0.3 +TRAIN_RPN_CLOOBER_POSITIVES = False + +RPN_MINIBATCH_SIZE = 256 +RPN_POSITIVE_RATE = 0.5 +RPN_NMS_IOU_THRESHOLD = 0.7 +RPN_TOP_K_NMS_TRAIN = 12000 +RPN_MAXIMUM_PROPOSAL_TARIN = 2000 + +RPN_TOP_K_NMS_TEST = 6000 +RPN_MAXIMUM_PROPOSAL_TEST = 1000 + +# specific settings for FPN +# FPN_TOP_K_PER_LEVEL_TRAIN = 2000 +# FPN_TOP_K_PER_LEVEL_TEST = 1000 + +# -------------------------------------------Fast-RCNN config +ROI_SIZE = 14 +ROI_POOL_KERNEL_SIZE = 2 +USE_DROPOUT = False +KEEP_PROB = 1.0 +SHOW_SCORE_THRSHOLD = 0.5 # only show in tensorboard + +FAST_RCNN_NMS_IOU_THRESHOLD = 0.3 # 0.6 +FAST_RCNN_NMS_MAX_BOXES_PER_CLASS = 100 +FAST_RCNN_IOU_POSITIVE_THRESHOLD = 0.5 +FAST_RCNN_IOU_NEGATIVE_THRESHOLD = 0.0 # 0.1 < IOU < 0.5 is negative +FAST_RCNN_MINIBATCH_SIZE = 512 # if is -1, that is train with OHEM +FAST_RCNN_POSITIVE_RATE = 0.25 + +ADD_GTBOXES_TO_TRAIN = False + + +