diff --git a/README.md b/README.md index 4eb1f1bf243071f99cf583dc8aee8ce1be2fbbb3..47df2d4c675b5fc3eea2e1e093dfa64e81512e66 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,10 @@ This project is released under the [Apache 2.0 license](LICENSE). ## Updates +v0.5.2 (21/10/2018) +- Add support for custom datasets. +- Add a script to convert PASCAL VOC annotations to the expected format. + v0.5.1 (20/10/2018) - Add BBoxAssigner and BBoxSampler, the `train_cfg` field in config files are restructured. - `ConvFCRoIHead` / `SharedFCRoIHead` are renamed to `ConvFCBBoxHead` / `SharedFCBBoxHead` for consistency. @@ -209,6 +213,48 @@ Expected results in WORK_DIR: > 1. We recommend using distributed training with NCCL2 even on a single machine, which is faster. Non-distributed training is for debugging or other purposes. > 2. The default learning rate is for 8 GPUs. If you use less or more than 8 GPUs, you need to set the learning rate proportional to the GPU num. E.g., modify lr to 0.01 for 4 GPUs or 0.04 for 16 GPUs. +### Train on custom datasets + +We define a simple annotation format. + +The annotation of a dataset is a list of dict, each dict corresponds to an image. +There are 3 field `filename` (relative path), `width`, `height` for testing, +and an additional field `ann` for training. `ann` is also a dict containing at least 2 fields: +`bboxes` and `labels`, both of which are numpy arrays. Some datasets may provide +annotations like crowd/difficult/ignored bboxes, we use `bboxes_ignore` and `labels_ignore` +to cover them. + +Here is an example. +``` +[ + { + 'filename': 'a.jpg', + 'width': 1280, + 'height': 720, + 'ann': { + 'bboxes': <np.ndarray> (n, 4), + 'labels': <np.ndarray> (n, ), + 'bboxes_ignore': <np.ndarray> (k, 4), + 'labels_ignore': <np.ndarray> (k, 4) (optional field) + } + }, + ... +] +``` + +There are two ways to work with custom datasets. + +- online conversion + + You can write a new Dataset class inherited from `CustomDataset`, and overwrite two methods + `load_annotations(self, ann_file)` and `get_ann_info(self, idx)`, like [CocoDataset](mmdet/datasets/coco.py). + +- offline conversion + + You can convert the annotation format to the expected format above and save it to + a pickle file, like [pascal_voc.py](tools/convert_datasets/pascal_voc.py). + Then you can simply use `CustomDataset`. + ## Technical details Some implementation details and project structures are described in the [technical details](TECHNICAL_DETAILS.md). diff --git a/mmdet/datasets/custom.py b/mmdet/datasets/custom.py index 3ae470443511c1164388d443c2623b454fa20d84..3640a83db9ac10504ea6076ceff88bf1cdfa3ec8 100644 --- a/mmdet/datasets/custom.py +++ b/mmdet/datasets/custom.py @@ -271,4 +271,4 @@ class CustomDataset(Dataset): data = dict(img=imgs, img_meta=img_metas) if self.proposals is not None: data['proposals'] = proposals - return data \ No newline at end of file + return data diff --git a/setup.py b/setup.py index 1803b7344593d95e37b868c77cd8b7352b1487fc..911519597e6e3b50bc4e5e8aa3a61461d9947daf 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ def readme(): MAJOR = 0 MINOR = 5 -PATCH = 1 +PATCH = 2 SUFFIX = '' SHORT_VERSION = '{}.{}.{}{}'.format(MAJOR, MINOR, PATCH, SUFFIX)