Custom dataset without segmentations
See original GitHub issueIs there a way to run a custom dataset that only has bounding boxes? I have the Wider Face dataset in COCO api json format, but it won’t train without a segmentation
field in annotations
. I had to use two work arounds:
- Use
annotation['segmenation'] = 0
andannotation['area'] = bbox_height * bbox_width
(and of course leavingTRAIN.GT_MIN_AREA = -1
) - To allow
TRAIN.USE_FLIPPED = True
, Detectron/lib/datasets/roidb.py had to have some code commented out in this function:
def extend_with_flipped_entries(roidb, dataset):
"""Flip each entry in the given roidb and return a new roidb that is the
concatenation of the original roidb and the flipped entries.
"Flipping" an entry means that that image and associated metadata (e.g.,
ground truth boxes and object proposals) are horizontally flipped.
"""
flipped_roidb = []
for entry in roidb:
width = entry['width']
boxes = entry['boxes'].copy()
oldx1 = boxes[:, 0].copy()
oldx2 = boxes[:, 2].copy()
boxes[:, 0] = width - oldx2 - 1
boxes[:, 2] = width - oldx1 - 1
assert (boxes[:, 2] >= boxes[:, 0]).all()
flipped_entry = {}
dont_copy = ('boxes', 'segms', 'gt_keypoints', 'flipped')
for k, v in entry.items():
if k not in dont_copy:
flipped_entry[k] = v
flipped_entry['boxes'] = boxes
### commenting out to allow flipping for datasets without segmentations annotated
#flipped_entry['segms'] = segm_utils.flip_segms(
# entry['segms'], entry['height'], entry['width']
#)
if dataset.keypoints is not None:
flipped_entry['gt_keypoints'] = keypoint_utils.flip_keypoints(
dataset.keypoints, dataset.keypoint_flip_map,
entry['gt_keypoints'], entry['width']
)
flipped_entry['flipped'] = True
flipped_roidb.append(flipped_entry)
roidb.extend(flipped_roidb)
With those two adjustments the code runs beautifully. Is there a flag or config param that I am missing, or an easier way to run datasets with only bboxes?
Thank you for the code and the docker version!
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Fine-Tune a Semantic Segmentation Model with a Custom ...
This guide shows how you can fine-tune Segformer, a state-of-the-art semantic segmentation model. Our goal is to build a model for a pizza ......
Read more >How I Created a Dataset for Instance Segmentation ... - MLWhiz
This post is about creating your own custom dataset for Image Segmentation/Object Detection. So, Why Not OID or any other dataset on the ......
Read more >2: Train with customized datasets
2: Train with customized datasets. In this note, you will know how to inference, test, and train predefined models with customized datasets.
Read more >How to Train YOLOv5 Instance Segmentation with Custom Data
This blog will walk through how to train YOLOv5 for instance segmentation on a custom dataset.
Read more >Custom Instance Segmentation Training With 7 Lines Of Code.
The steps required to train a custom model. ... STEP1: Prepare your dataset: Our goal is to create a model that can perform...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @learnbott, I think it may be simpler and less error-prone to preprocess your json annotations to include the following entries:
I believe this would allow you to perform training (w/ flipping) without any modifications to the code.
Much appreciated!
On Sat, Jan 27, 2018 at 4:51 PM, Ilija Radosavovic <notifications@github.com