Skip to content

Commit

Permalink
Update for Pruning tool, include merged 2007 and 2012 VOC dataset sup…
Browse files Browse the repository at this point in the history
…port
  • Loading branch information
fanghuaqi committed May 25, 2018
1 parent 781a917 commit 8e494b4
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/datasets/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import numpy as np

# Set up voc_<year>_<split> using selective search "fast" mode
for year in ['2007', '2012']:
for year in ['2007', '2012', '0712']:
for split in ['train', 'val', 'trainval', 'test']:
name = 'voc_{}_{}'.format(year, split)
__sets[name] = (lambda split=split, year=year: pascal_voc(split, year))
Expand Down
6 changes: 6 additions & 0 deletions lib/datasets/voc_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,12 @@ def voc_eval(detpath,
# sort by confidence
sorted_ind = np.argsort(-confidence)
sorted_scores = np.sort(-confidence)
###FIX added
if (len(sorted_ind)<1):
rec = 0
prec = 0
ap = 0
return rec, prec, ap
BB = BB[sorted_ind, :]
image_ids = [image_ids[x] for x in sorted_ind]

Expand Down
4 changes: 2 additions & 2 deletions lib/fast_rcnn/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
__C.TRAIN.MAX_SIZE = 1000

# Images to use per minibatch
__C.TRAIN.IMS_PER_BATCH = 2
__C.TRAIN.IMS_PER_BATCH = 1

# Minibatch size (number of regions of interest [ROIs])
__C.TRAIN.BATCH_SIZE = 128
Expand Down Expand Up @@ -97,7 +97,7 @@
__C.TRAIN.ASPECT_GROUPING = True

# Use RPN to detect objects
__C.TRAIN.HAS_RPN = False
__C.TRAIN.HAS_RPN = True
# IOU >= thresh: positive example
__C.TRAIN.RPN_POSITIVE_OVERLAP = 0.7
# IOU < thresh: negative example
Expand Down
1 change: 1 addition & 0 deletions lib/fast_rcnn/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

from caffe.proto import caffe_pb2
import google.protobuf as pb2
import google.protobuf.text_format

class SolverWrapper(object):
"""A simple wrapper around Caffe's solver.
Expand Down
3 changes: 3 additions & 0 deletions lib/rpn/proposal_target_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ def _get_bbox_regression_labels(bbox_target_data, num_classes):
cls = clss[ind]
start = 4 * cls
end = start + 4
start=int(start)
end=int(end)
bbox_targets[ind, start:end] = bbox_target_data[ind, 1:]
bbox_inside_weights[ind, start:end] = cfg.TRAIN.BBOX_INSIDE_WEIGHTS
return bbox_targets, bbox_inside_weights
Expand Down Expand Up @@ -161,6 +163,7 @@ def _sample_rois(all_rois, gt_boxes, fg_rois_per_image, rois_per_image, num_clas
# Guard against the case when an image has fewer than fg_rois_per_image
# foreground RoIs
fg_rois_per_this_image = min(fg_rois_per_image, fg_inds.size)
fg_rois_per_this_image=int(fg_rois_per_this_image)
# Sample foreground regions without replacement
if fg_inds.size > 0:
fg_inds = npr.choice(fg_inds, size=fg_rois_per_this_image, replace=False)
Expand Down

0 comments on commit 8e494b4

Please sign in to comment.