Skip to content

Commit

Permalink
Fix the num_classes issue.
Browse files Browse the repository at this point in the history
num_classes should be 1 + actual_classes.
Related to google#492  google#391  google#521
  • Loading branch information
mingxingtan committed Jun 19, 2020
1 parent bf6221d commit 7ab026b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions efficientdet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ Download data and checkpoints.

Create a config file for the PASCAL VOC dataset called voc_config.yaml and put this in it.

num_classes: 20
num_classes: 21
var_freeze_expr: '(efficientnet|fpn_cells|resample_p6)'
label_id_mapping: {0: background, 1: aeroplane, 2: bicycle, 3: bird, 4: boat, 5: bottle, 6: bus, 7: car, 8: cat, 9: chair, 10: cow, 11: diningtable, 12: dog, 13: horse, 14: motorbike, 15: person, 16: pottedplant, 17: sheep, 18: sofa, 19: train, 20: tvmonitor}

Expand Down Expand Up @@ -295,7 +295,7 @@ Install [horovod](https://github.com/horovod/horovod#id6).

Create a config file for the PASCAL VOC dataset called voc_config.yaml and put this in it.

num_classes: 20
num_classes: 21
var_freeze_expr: '(efficientnet|fpn_cells|resample_p6)'
label_id_mapping: {0: background, 1: aeroplane, 2: bicycle, 3: bird, 4: boat, 5: bottle, 6: bus, 7: car, 8: cat, 9: chair, 10: cow, 11: diningtable, 12: dog, 13: horse, 14: motorbike, 15: person, 16: pottedplant, 17: sheep, 18: sofa, 19: train, 20: tvmonitor}

Expand Down
6 changes: 4 additions & 2 deletions efficientdet/hparams_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,9 @@ def default_detection_configs():
h.augmix_params = (3, -1, 1)

# dataset specific parameters
h.num_classes = 90
# TODO(tanmingxing): update this to be 91 for COCO, and 21 for pascal.
h.num_classes = 90 # 1+ actual classes, 0 is reserved for background.

h.skip_crowd_during_training = True
h.label_id_mapping = None
h.max_instances_per_image = 100 # Default to 100 for COCO.
Expand Down Expand Up @@ -246,7 +248,7 @@ def default_detection_configs():
h.conv_bn_act_pattern = False

# For post-processing nms, must be a dict.
h.nms_configs = None
h.nms_configs = {'method': 'hard'}

# version.
h.fpn_name = None
Expand Down

0 comments on commit 7ab026b

Please sign in to comment.