Beispiel #1
0
def register_voc_data(args):
    register_pascal_voc("pascal_trainval_2007",
                        args.DATASETS.CLASSIFIER_DATAROOT + 'VOC2007/',
                        'trainval', 2007)
    register_pascal_voc("pascal_trainval_2012",
                        args.DATASETS.CLASSIFIER_DATAROOT + 'VOC2012/',
                        'trainval', 2012)
    register_pascal_voc("pascal_test_2007",
                        args.DATASETS.CLASSIFIER_DATAROOT + 'VOC2007/', 'test',
                        2007)
Beispiel #2
0
from detectron2.data import MetadataCatalog, DatasetCatalog
from detectron2.engine import DefaultTrainer, default_argument_parser, default_setup, hooks, launch
from detectron2.evaluation import (
    DatasetEvaluators,
    PascalVOCDetectionEvaluator,
    verify_results,
)
from detectron2.modeling import GeneralizedRCNNWithTTA

from detectron2.data.datasets.pascal_voc import register_pascal_voc

_datasets_root = "datasets"
for d in ["trainval", "test"]:
    register_pascal_voc(name=f'100DOH_hand_{d}',
                        dirname=_datasets_root,
                        split=d,
                        year=2007,
                        class_names=["hand"])
    MetadataCatalog.get(f'100DOH_hand_{d}').set(evaluator_type='pascal_voc')


class Trainer(DefaultTrainer):
    """
    We use the "DefaultTrainer" which contains pre-defined default logic for
    standard training workflow. They may not work for you, especially if you
    are working on a new research project. In that case you can use the cleaner
    "SimpleTrainer", or write your own training loop. You can use
    "tools/plain_train_net.py" as an example.
    """
    @classmethod
    def build_evaluator(cls, cfg, dataset_name, output_folder=None):
Beispiel #3
0
    COCOPanopticEvaluator,
    DatasetEvaluators,
    LVISEvaluator,
    PascalVOCDetectionEvaluator,
    SemSegEvaluator,
    verify_results,
)
from detectron2.modeling import GeneralizedRCNNWithTTA

# more import
from detectron2.data.datasets.pascal_voc import register_pascal_voc

_datasets_root = "datasets"
for d in ["train", "val"]:
    register_pascal_voc(name=f'100DOH_hand_{d}',
                        dirname=_datasets_root,
                        split=d,
                        year=2007)
    MetadataCatalog.get(f'100DOH_hand_{d}').set(evaluator_type='pascal_voc')


class Trainer(DefaultTrainer):
    """
    We use the "DefaultTrainer" which contains pre-defined default logic for
    standard training workflow. They may not work for you, especially if you
    are working on a new research project. In that case you can use the cleaner
    "SimpleTrainer", or write your own training loop. You can use
    "tools/plain_train_net.py" as an example.
    """
    @classmethod
    def build_evaluator(cls, cfg, dataset_name, output_folder=None):
        """