summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3170ecd)
raw | patch | inline | side by side (parent: 3170ecd)
author | Soyeb N Nagori <a0875091@udb0393608> | |
Tue, 5 Jun 2018 03:30:44 +0000 (09:00 +0530) | ||
committer | Soyeb N Nagori <a0875091@udb0393608> | |
Mon, 11 Jun 2018 19:04:59 +0000 (00:34 +0530) |
diff --git a/scripts/infer_video_object_experimental.py b/scripts/infer_video_object_experimental.py
index f706ae83bdb1142660c20ad4ec51b87865e6fa31..4f840fa096f28dd8ffefc2eb9f9a17541e4b589f 100644 (file)
cropMaxX=params.cropMaxX, cropMaxY=params.cropMaxY, decFreq = params.decFreq,
enObjProp=params.enObjProp, start_frame_num=params.start_frame_num,
maxAgeTh=params.maxAgeTh, caffe_root=params.caffe_root,
- externalDet=params.externalDet,
- externalDetPath=params.externalDetPath,
- enObjPropExp=params.enObjPropExp)
+ externalDet=params.externalDet, externalDetPath=params.externalDetPath,
+ enObjPropExp=params.enObjPropExp, confThM=params.CONF_TH_M,
+ confThMStrngTrk=params.CONF_TH_M_STRNG_TRK, confThH=params.CONF_TH_H)
if params.EVAL_OBJ:
filename, file_extension = os.path.splitext(fileName)
params.cropMaxX=params.cropMinX+crop_w
params.cropMaxY=params.cropMinY+crop_h
- params.NumFrames=50
+ params.NumFrames=5000
params.start_frame_num=0
# ResizeW and ResizeH are not used when multiple sclales are used
# When these options are non zero first crop (if enabled) then resizing will be done before anything else
#params.TILE_STEP_X=192
params.WRITE_BBOX = True
params.decFreq = 1
+
params.enObjProp=True
params.enObjPropExp=True
params.NMS_FLAG=1
+ params.CONF_TH_M = 0.12
if params.enObjPropExp:
params.maxAgeTh=300000
+ params.CONF_TH_M = 0.15
+ params.CONF_TH_M_STRNG_TRK = 0.12
+ params.CONF_TH_H = 0.4
else:
params.maxAgeTh=30
Params.ModelWeights="/user/a0875091/files/work/bitbucket_TI/caffe-jacinto-models/scripts/training/ti-vgg-720x368-v2/JDetNet/20180211_01-20_ds_PSP_dsFac_32_fc_0_hdDS8_1_cnctHD_0_baseNW3hd_0_kerMbox_1_1stHdSameOpCh_1/sparse_fac0.5_54.31/ti-vgg-720x368-v2_ssdJacintoNetV2_iter_2000_fac0.5_53.77.caffemodel"
Params.Deploy="/user/a0875091/files/work/bitbucket_TI/caffe-jacinto-models/scripts/training/ti-vgg-720x368-v2/JDetNet/20180211_01-20_ds_PSP_dsFac_32_fc_0_hdDS8_1_cnctHD_0_baseNW3hd_0_kerMbox_1_1stHdSameOpCh_1/sparse_fac0.5_54.31/deploy.prototxt"
Params.LabelMap="/user/a0875091/files/work/github/weiliu89/caffe-ssd/data/TI_201712_720x368_V1/labelmap.prototxt"
-params.OpPath="/data/mmcodec_video2_tier3/users/soyeb/ObjectDetect/ssd/detetctedOp/20180602_JDetNet_720x368_1Gmac_53.77_objPropExpV4_0.12_0.2_0.55_VIRB0003_debug/"
+params.OpPath="/data/mmcodec_video2_tier3/users/soyeb/ObjectDetect/ssd/detetctedOp/20180602_JDetNet_720x368_1Gmac_53.77_objPropExpV4_0.12_0.15_0.2_0.4_VIRB0003_Debug/"
#dir containing GT annotations in KITTI format
#gtDIR = '/data/mmcodec_video2_tier3/users/soyeb/ObjectDetect/ssd/data/tempdata_TI201708/data/train/Videos/'
diff --git a/scripts/nms_ti.py b/scripts/nms_ti.py
index e58d82fc64d7c3876d07663f0ce95399699bd6d7..08df1f1da07bedc7a466fd63df4e888c2698a8f9 100755 (executable)
--- a/scripts/nms_ti.py
+++ b/scripts/nms_ti.py
print "oIdx is suppressing iIdx", oIdx, iIdx
print(boxes[oIdx,5], "is suppressing", boxes[iIdx,5])
- #if oBox is suppressing iBox then take age from iBox
+ #if oBox is suppressing iBox then take age info from iBox
+ #if oBox is suppressing iBox then keep strng_trk True if either of the
+ #boxes was strng
#FIX_ME: Make it conditional on flag from config file
if (ol>olTh) and enObjPropExp:
boxes[oIdx,6] = boxes[iIdx,6]
+ boxes[oIdx,7] = boxes[oIdx,7] or boxes[iIdx,7]
if (verbose > 1) and suppress[iIdx]:
print "oIdx,iIdx", oIdx, iIdx
index 95fd83963911a6f5851afd2b511666d502d1166a..c3a8b7b13298d774577e5ac13734e7a34f13f864 100644 (file)
--- a/scripts/propagate_obj.py
+++ b/scripts/propagate_obj.py
debugDrawTracks = False
debugPrintFindOL = False
-
AGE_IDX = 6
SCORE_IDX = 5
LBL_IDX = 4
curImage = curImageFloat.astype('uint8')
frame_gray = cv2.cvtColor(curImage, cv2.COLOR_BGR2GRAY)
- if params.enObjPropExp:
- modConfTh = 0.15
- #for strong tracks, continue trackign if it find match with 0.12
- modConfThForStrngTrk = 0.12
- else:
- modConfTh = 0.12
-
- top_conf, top_label_indices, top_xmin, top_ymin, top_xmax, top_ymax = getObjsAboveScore(modConfTh=modConfTh,
+ r1, r2, r3, r4, r5, r6 = getObjsAboveScore(modConfTh=params.confThM,
labelmap=labelmap, lblMapHashBased=lblMapHashBased,
raw_dets_cur_frm=raw_dets_cur_frm, W=frame_gray.shape[1],
H=frame_gray.shape[0])
- top_conf_strngTrk, top_label_indices_strngTrk, top_xmin_strngTrk, top_ymin_strngTrk, top_xmax_strngTrk, top_ymax_strngTrk = getObjsAboveScore(modConfTh=modConfThForStrngTrk, labelmap=labelmap, lblMapHashBased=lblMapHashBased, raw_dets_cur_frm=raw_dets_cur_frm,
- W=frame_gray.shape[1], H=frame_gray.shape[0])
+ top_conf=r1
+ top_label_indices=r2
+ top_xmin=r3
+ top_ymin=r4
+ top_xmax=r5
+ top_ymax=r6
+
+
+ #for strong tracks, continue trackign if it find match with confThMStrngTrk
+ r1, r2, r3, r4, r5, r6 = getObjsAboveScore(modConfTh=params.confThMStrngTrk,
+ labelmap=labelmap, lblMapHashBased=lblMapHashBased,
+ raw_dets_cur_frm=raw_dets_cur_frm,W=frame_gray.shape[1], H=frame_gray.shape[0])
+
+ top_conf_strngTrk=r1
+ top_label_indices_strngTrk=r2
+ top_xmin_strngTrk=r3
+ top_ymin_strngTrk=r4
+ top_xmax_strngTrk=r5
+ top_ymax_strngTrk=r6
+
#det_cur_mod_conf= np.array(det_cur_mod_conf)
#print "after pruning with moderate score", det_cur_mod_conf.shape
objPoolInCurScale[idx][1] = (objPoolInCurScale[idx][1] - offsetY) / scaleY
objPoolInCurScale[idx][2] = (objPoolInCurScale[idx][2] - offsetX) / scaleX
objPoolInCurScale[idx][3] = (objPoolInCurScale[idx][3] - offsetY) / scaleY
- if(detObj[SCORE_IDX] > 0.55) and params.enObjPropExp:
+ if(detObj[SCORE_IDX] > params.confThH) and params.enObjPropExp:
detObj[STRNG_TRK_IDX] = 1
+ gPoolDetObjs[idx][STRNG_TRK_IDX] = 1
+
+ if debugPrintObjProp:
+ print "gPoolDetObjs after strong track check: "
+ print gPoolDetObjs
if debugPrintObjProp:
print "objPoolInCurScale: "
print "good_old ", good_old
trackedObjsList = []
+
+ if debugPrintObjProp:
+ print "gPoolDetObjs before using strong track info: "
+ print gPoolDetObjs
+
#find the nearset corner point to TL and BR and adjust tracked window
for idx, detObj in enumerate(gPoolDetObjs):
tlX = detObj[0]
index 8b555c687ccd01b366fd62c7395293e14c988c2b..f222be70d95a5ccab9c34da0d40a3cdc84ac2cc4 100644 (file)
write_boxes_afr_nms = True
#0,1
nms_verbose=0
+print_frame_info = True
###################################################################################################
def visualize_weights(net, layer_name, padding=4, filename=''):
@@ -215,7 +216,7 @@ def processOneCrop(curScaleImage, transformer, net, drawHandle, detBBoxesCurFram
##################################################################################################
def writeOneBox(enable=False, bbox=[], label_name='', score=-1.0, fileHndl='',
- writeBboxMap=[], age=0):
+ writeBboxMap=[], age=0, strng_trk=0):
if enable:
# KITTI benchmarking format
#map to category specified in writeBboxMap
if label_name == xlation[0]:
label_name = xlation[1]
- newLine = '{} 0 0 0 {} {} {} {} 0 0 0 0 0 0 0 {} {} \n'.format(label_name,
- bbox[0],bbox[1],bbox[2], bbox[3], score, age)
+ newLine = '{} 0 0 0 {} {} {} {} 0 0 0 0 0 0 0 {} {} {} \n'.format(label_name,
+ bbox[0],bbox[1],bbox[2], bbox[3], score, age, strng_trk)
#print "newLine: ", newLine
fileHndl.write(newLine)
if writeThisBox:
writeOneBox(enable=params.writeBbox, bbox=detObjs[i], label_name=label_name,
score=score, fileHndl=detObjFileHndl, writeBboxMap=writeBboxMap,
- age=age)
+ age=age, strng_trk=strng_trk)
return
def wrapMulScls(imageCurFrame, transformer, net, params, numScales=4, curFrameNum=0,
detObjsFile='', writeBboxMap=[], labelmap=''):
- print_frame_info= False
if(curFrameNum == 0):
wrapMulScls.gPoolDetObjs = np.asarray([])
@@ -514,6 +514,12 @@ def wrapMulScls(imageCurFrame, transformer, net, params, numScales=4, curFrameNu
print detObjRectListNPArray
if params.enObjProp:
+ if params.enObjPropExp:
+ for idx,detObj in enumerate(detObjRectListNPArray):
+ #FIX_ME:SN
+ detObjRectListNPArray[idx][7] = (detObjRectListNPArray[idx][5] >
+ params.confThH)
+
opFilenameWOExt, fileExt = os.path.splitext(params.opFileName)
wrapMulScls.gPoolDetObjs = propagate_obj(gPoolDetObjs=wrapMulScls.gPoolDetObjs,
curImageFloat=imageCoreIpCurScale*255.0, curFrameNum=curFrameNum, scaleX=curScaleX,
@@ -573,6 +579,14 @@ def wrapMulScls(imageCurFrame, transformer, net, params, numScales=4, curFrameNu
detObjFileHndl.close()
if(len(detObjRectListNPArray)):
+ if print_frame_info:
+ print "type(wrapMulScls.gPoolDetObjs): ", type(wrapMulScls.gPoolDetObjs)
+ print "Global pool Before draeBoxes"
+ print "gPoolDetObjs.dtype: ", wrapMulScls.gPoolDetObjs.dtype
+ print "gPoolDetObjs.shape: ", wrapMulScls.gPoolDetObjs.shape
+ print "gPoolDetObjs: "
+ print wrapMulScls.gPoolDetObjs
+
drawBoxes(params=params,detObjs=wrapMulScls.gPoolDetObjs, drawHandle=curFrameDrawHandle,
writeBboxMap=writeBboxMap, labelmap=labelmap, lblMapHashBased=params.externalDet)
tileStepX=0, tileStepY=0, meanPixVec=[104.0,117.0,123.0], ipScale=1.0,
writeBboxMap=[], decFreq=1, enObjProp=False, start_frame_num=0,
maxAgeTh=8, caffe_root='', externalDet=False, externalDetPath='',
- enObjPropExp=False):
+ enObjPropExp=False, confThM=0.12, confThMStrngTrk=0.12, confThH=0.4):
+
###################################################################################
enum_multipleTiles = 0
enum_multipleScales = 1
print "numScales " , self.numScales
print "arType " , self.arType
print "confTh " , self.confTh
+ print "confThM " , self.confThM
+ print "confThMStrngTrk " , self.confThMStrngTrk
+ print "confThH " , self.confThH
print "writeBbox" , self.writeBbox
print "decFreq" , self.decFreq
print "writeBboxMap" , self.writeBboxMap
params.numScales = numScales
params.arType = arType
params.confTh = confTh
+ params.confThM = confThM
+ params.confThMStrngTrk = confThMStrngTrk
+ params.confThH = confThH
params.writeBbox = writeBbox
params.decFreq = decFreq
params.writeBboxMap = writeBboxMap