for i in range(1): bboxes1, target_labels, target_deltas = filters_detection.reduceData( Y_tmp, cfg) bboxes2 = np.copy(bboxes1) bboxes2 = filters_detection.prepareInputs(bboxes2, imageDims, imageMeta) import draw import filters_detection img = np.copy(X[0]) img += cfg.PIXEL_MEANS img = img.astype(np.uint8) bboxes2 = filters_detection.unprepareInputs(bboxes2, imageDims) draw.drawOverlapAnchors(img, bboxes2[0], imageMeta, imageDims, cfg) draw.drawGTBoxes(img, imageMeta, imageDims) if False: redux = {} imageID = '487566' redux[imageID] = genTrain.imagesInputs[imageID] i = 0 goal = 5000 for imageID, inputMeta in genTrain.imagesInputs.items(): redux[imageID] = inputMeta utils.update_progress_new(i + 1, goal, imageID) if i == goal: break
genVal = DataGenerator(imagesMeta = data.valGTMeta, cfg=cfg, data_type='val').begin() X, [Y1,Y2], imageMeta, imageDims = next(genVal) # filter X = X[0] rpn_props = Y1[:,:,:,9:] rpn_deltas = Y2[:,:,:,36:] # post preprocessing pred_anchors = helper.deltas2Anchors(rpn_props, rpn_deltas, cfg, imageDims) pred_anchors = helper.non_max_suppression_fast(pred_anchors, overlap_thresh=cfg.detection_nms_overlap_thresh) pred_anchors = pred_anchors[:, 0: -1] # get inputs and targets rois, true_labels, true_boxes, IouS = filters_detection.prepareTargets(pred_anchors, imageMeta, imageDims, class_mapping, cfg) norm_rois = filters_detection.prepareInputs(rois, imageDims) # reduce and filter samples = helper.reduce_rois(true_labels, cfg) rois = rois[samples, :] norm_rois = norm_rois[:, samples, :] det_props = true_labels[:, samples, :] det_deltas = true_boxes[:, samples, 320:] # post preprocessing pred_boxes = helper.deltas2Boxes(det_props, det_deltas, rois, cfg) #pred_boxes = helper.non_max_suppression_boxes(pred_boxes, cfg) import draw anchors = draw.drawPositiveRois(X, pred_boxes) bboxes = draw.drawGTBoxes(X, imageMeta, imageDims)