def register_datasets(backend): """Import and register datasets automatically.""" if backend == "pytorch": from . import pytorch ClassFactory.lazy_register("zeus.datasets.common", {"imagenet": ["Imagenet"]}) elif backend == "tensorflow": from . import tensorflow ClassFactory.lazy_register("zeus.datasets.tensorflow", {"imagenet": ["Imagenet"]}) elif backend == "mindspore": import mindspore.dataset from . import mindspore ClassFactory.lazy_register("zeus.datasets.common", {"imagenet": ["Imagenet"]}) from . import common from . import transforms
from .network_desc import NetworkDesc ClassFactory.lazy_register( "zeus.networks", { "adelaide": ["AdelaideFastNAS"], "bert": ["BertClassifier"], "dnet": ["DNet", "DNetBackbone"], "erdb_esr": ["ESRN"], "faster_backbone": ["FasterBackbone"], "faster_rcnn": ["FasterRCNN"], "mobilenet": ["MobileNetV3Tiny", "MobileNetV2Tiny"], "mobilenetv3": ["MobileNetV3Small", "MobileNetV3Large"], "necks": ["FPN"], "quant": ["Quantizer"], "resnet_det": ["ResNetDet"], "resnet_general": ["ResNetGeneral"], "resnet": ["ResNet"], "resnext_det": ["ResNeXtDet"], "sgas_network": ["SGASNetwork"], "simple_cnn": ["SimpleCnn"], "spnet_backbone": ["SpResNetDet"], "super_network": ["DartsNetwork", "CARSDartsNetwork", "GDASDartsNetwork"], "text_cnn": ["TextCells", "TextCNN"], "gcn": ["GCN"], # xingtian "mtm_sr": ["MtMSR"], "xt_model": ["DqnMlpNet", "DqnCnnNet", "mse_loss"], })
# -*- coding:utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # This program is free software; you can redistribute it and/or modify # it under the terms of the MIT License. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MIT License for more details. """Lazy import getter network.""" from zeus.common.class_factory import ClassFactory ClassFactory.lazy_register("zeus.networks.pytorch.getters", { "prune_getter": ["network:PruneGetter"], })
# -*- coding:utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # This program is free software; you can redistribute it and/or modify # it under the terms of the MIT License. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MIT License for more details. """Lazy import detector.""" from zeus.common.class_factory import ClassFactory ClassFactory.lazy_register("zeus.networks.pytorch.detectors", { "auto_lane_detector": ["AutoLaneDetector"], })
# -*- coding:utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # This program is free software; you can redistribute it and/or modify # it under the terms of the MIT License. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MIT License for more details. """Lazy import pytorch backbones.""" from zeus.common.class_factory import ClassFactory ClassFactory.lazy_register("zeus.networks.pytorch.backbones", { "getter": ["BackboneGetter"], "load_official_model": ["OffcialModelLoader"], "resnet_variant_det": ["ResNetVariantDet"], "resnext_variant_det": ["ResNeXtVariantDet"], })
# -*- coding:utf-8 -*- from .pipe_step import PipeStep from .pipeline import Pipeline from zeus.common.class_factory import ClassFactory ClassFactory.lazy_register( "vega.core.pipeline", { "search_pipe_step": ["SearchPipeStep"], "train_pipe_step": ["TrainPipeStep"], "benchmark_pipe_step": ["BenchmarkPipeStep"], })
# -*- coding:utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # This program is free software; you can redistribute it and/or modify # it under the terms of the MIT License. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MIT License for more details. """Lazy import loss functions.""" from zeus.common.class_factory import ClassFactory ClassFactory.lazy_register( "zeus.networks.pytorch.losses", { "sum_loss": ["trainer.loss:SumLoss"], "smooth_l1_loss": ["trainer.loss:SmoothL1Loss"], "custom_cross_entropy_loss": ["trainer.loss:CustomCrossEntropyLoss"], "cross_entropy_label_smooth": ["trainer.loss:CrossEntropyLabelSmooth"], "mix_auxiliary_loss": ["trainer.loss:MixAuxiliaryLoss"], })
# -*- coding:utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # This program is free software; you can redistribute it and/or modify # it under the terms of the MIT License. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MIT License for more details. """Lazy import mindspore network.""" from zeus.common.class_factory import ClassFactory ClassFactory.lazy_register( "zeus.networks.mindspore", { "dnet": ["DNet"], "super_network": ["DartsNetwork", "CARSDartsNetwork", "GDASDartsNetwork"], "prune_deformation": ["PruneDeformation", "Deformation"], "backbones.load_official_model": ["OffcialModelLoader"], "backbones.resnet_ms": ["ResNetMs"], "losses.mix_auxiliary_loss": ["MixAuxiliaryLoss"], })
# -*- coding:utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # This program is free software; you can redistribute it and/or modify # it under the terms of the MIT License. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MIT License for more details. """Lazy import hpo algorithms.""" from zeus.common.class_factory import ClassFactory ClassFactory.lazy_register( "vega.algorithms.hpo", { "asha_hpo": ["AshaHpo"], "bo_hpo": ["BoHpo"], "bohb_hpo": ["BohbHpo"], "boss_hpo": ["BossHpo"], "random_hpo": ["RandomSearch"], "random_pareto_hpo": ["RandomParetoHpo"], "evolution_search": ["EvolutionAlgorithm"], })
# -*- coding:utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # This program is free software; you can redistribute it and/or modify # it under the terms of the MIT License. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MIT License for more details. """Lazy import data augmentation algorithms.""" from zeus.common.class_factory import ClassFactory ClassFactory.lazy_register("vega.algorithms.data_augmentation", { "pba_hpo": ["PBAHpo"], "pba_trainer_callback": ["PbaTrainerCallback"], "cyclesr": ["CyclesrTrainerCallback"], })
from .metrics import Metrics from zeus.common.class_factory import ClassFactory ClassFactory.lazy_register("zeus.metrics.tensorflow", { "segmentation_metric": ["trainer.metric:IoUMetric"], "classifier_metric": ["trainer.metric:accuracy"], "sr_metric": ["trainer.metric:PSNR", "trainer.metric:SSIM"], "forecast": ["trainer.metric:MSE", "trainer.metric:RMSE"], })
# -*- coding:utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # This program is free software; you can redistribute it and/or modify # it under the terms of the MIT License. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MIT License for more details. """Import and register modules automatically.""" from zeus.common.class_factory import ClassFactory ClassFactory.lazy_register("zeus.modules", { "module": ["network:Module"], }) def register_modules(): """Import and register modules automatically.""" from . import blocks from . import cells from . import connections from . import operators from . import preprocess from . import loss from . import getters from . import deformations from . import necks from . import backbones
# -*- coding:utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # This program is free software; you can redistribute it and/or modify # it under the terms of the MIT License. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MIT License for more details. """Lazy import gan network.""" from zeus.common.class_factory import ClassFactory ClassFactory.lazy_register("zeus.networks.pytorch.gan", { "fully_super_network": ["network:Generator"], })
from .callback import Callback from .callback_list import CallbackList from zeus.common.class_factory import ClassFactory ClassFactory.lazy_register("zeus.trainer.callbacks", { "metrics_evaluator": ["trainer.callback:MetricsEvaluator"], "progress_logger": ["trainer.callback:ProgressLogger"], "performance_saver": ["trainer.callback:PerformanceSaver"], "lr_scheduler": ["trainer.callback:LearningRateScheduler"], "model_builder": ["trainer.callback:ModelBuilder"], "model_statistics": ["trainer.callback:ModelStatistics"], "model_checkpoint": ["trainer.callback:ModelCheckpoint"], "report_callback": ["trainer.callback:ReportCallback"], "runtime_callback": ["trainer.callback:RuntimeCallback"], "detection_progress_logger": ["trainer.callback:DetectionProgressLogger"], "detection_metrics_evaluator": ["trainer.callback:DetectionMetricsEvaluator"], "visual_callback": ["trainer.callback:VisualCallBack"], "model_tuner": ["trainer.callback:ModelTuner"], "timm_trainer_callback": ["trainer.callback:TimmTrainerCallback"], })
# This program is free software; you can redistribute it and/or modify # it under the terms of the MIT License. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MIT License for more details. """Lazy import nas algorithms.""" from zeus.common.class_factory import ClassFactory ClassFactory.lazy_register("vega.algorithms.nas", { "adelaide_ea": ["AdelaideCodec", "AdelaideMutate", "AdelaideRandom", "AdelaideEATrainerCallback"], "auto_lane": ["AutoLaneNas", "AutoLaneNasCodec", "AutoLaneTrainerCallback"], "backbone_nas": ["BackboneNasCodec", "BackboneNasSearchSpace", "BackboneNas"], "cars": ["CARSAlgorithm", "CARSTrainerCallback", "CARSPolicyConfig"], "darts_cnn": ["DartsCodec", "DartsFullTrainerCallback", "DartsNetworkTemplateConfig", "DartsTrainerCallback"], "dnet_nas": ["DblockNasCodec", "DblockNas", "DnetNasCodec", "DnetNas"], "esr_ea": ["ESRCodec", "ESRTrainerCallback", "ESRSearch"], "fis": ["AutoGateGrdaS1TrainerCallback", "AutoGateGrdaS2TrainerCallback", "AutoGateS1TrainerCallback", "AutoGateS2TrainerCallback", "AutoGroupTrainerCallback", "CtrTrainerCallback"], "mfkd": ["MFKD1", "SimpleCnnMFKD"], "modnas": ["ModNasAlgorithm", "ModNasTrainerCallback"], "segmentation_ea": ["SegmentationCodec", "SegmentationEATrainerCallback", "SegmentationNas"], "sgas": ["SGASTrainerCallback"], "sm_nas": ["SmNasCodec", "SMNasM"], "sp_nas": ["SpNasS", "SpNasP"], "sr_ea": ["SRCodec", "SRMutate", "SRRandom"], "mfasc": ["search_algorithm:MFASC"] })
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MIT License for more details. """Lazy import tensorflow networks.""" from .network import Sequential from zeus.common.class_factory import ClassFactory ClassFactory.lazy_register( "zeus.networks.tensorflow", { "resnet_tf": ["ResNetTF"], # backbones "backbones.resnet_det": ["ResNetDet"], # detectors "detectors.faster_rcnn_trainer_callback": ["FasterRCNNTrainerCallback"], "detectors.faster_rcnn": ["FasterRCNN"], "detectors.tf_optimizer": ["TFOptimizer"], # losses "losses.cross_entropy_loss": ["CrossEntropyLoss"], "losses.mix_auxiliary_loss": ["MixAuxiliaryLoss"], # necks "necks.mask_rcnn_box": ["MaskRCNNBox"], }) ClassFactory.lazy_register( "zeus.networks.tensorflow.utils", { "anchor_utils.anchor_generator": ["AnchorGenerator"], "hyperparams.initializer": ["Initializer"], "hyperparams.regularizer": ["Regularizer"], })
# -*- coding:utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # This program is free software; you can redistribute it and/or modify # it under the terms of the MIT License. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MIT License for more details. """Lazy import compression algorithms.""" from zeus.common.class_factory import ClassFactory ClassFactory.lazy_register( "vega.algorithms.compression", { "prune_ea": ["PruneCodec", "PruneEA", "PruneSearchSpace", "PruneTrainerCallback"], "prune_ea_mobilenet": ["PruneMobilenetCodec", "PruneMobilenetTrainerCallback"], "quant_ea": ["QuantCodec", "QuantEA", "QuantTrainerCallback"], })
# -*- coding:utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # This program is free software; you can redistribute it and/or modify # it under the terms of the MIT License. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MIT License for more details. """Lazy import modules.""" from zeus.common.class_factory import ClassFactory ClassFactory.lazy_register( "zeus.modules.deformations", { "deformation": ["Deformation"], "backbone_deformation": ["BackboneDeformation"], "prune_deformation": ["PruneDeformation"] })
from .metrics import Metrics from zeus.common.class_factory import ClassFactory ClassFactory.lazy_register( "zeus.metrics.pytorch", { "lane_metric": ["trainer.metric:LaneMetric"], "regression": ["trainer.metric:MSE", "trainer.metric:mse"], "detection_metric": ["trainer.metric:CocoMetric", "trainer.metric:coco"], "gan_metric": ["trainer.metric:GANMetric"], "classifier_metric": [ "trainer.metric:accuracy", "trainer.metric:Accuracy", "trainer.metric:SklearnMetrics" ], "auc_metrics": ["trainer.metric:AUC", "trainer.metric:auc"], "segmentation_metric": ["trainer.metric:IoUMetric"], "sr_metric": ["trainer.metric:PSNR", "trainer.metric:SSIM"], })
from .metrics import Metrics from zeus.common.class_factory import ClassFactory ClassFactory.lazy_register( "zeus.metrics.mindspore", { "segmentation_metric": ["trainer.metric:IoUMetric"], "classifier_metric": ["trainer.metric:accuracy"], "sr_metric": ["trainer.metric:PSNR", "trainer.metric:SSIM"], })
# -*- coding:utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # This program is free software; you can redistribute it and/or modify # it under the terms of the MIT License. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MIT License for more details. """Lazy import necks.""" from zeus.common.class_factory import ClassFactory ClassFactory.lazy_register("zeus.networks.pytorch.necks", { "ffm": ["network:FeatureFusionModule"], "fpn": ["TorchFPN"] })
# -*- coding:utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # This program is free software; you can redistribute it and/or modify # it under the terms of the MIT License. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MIT License for more details. """Lazy import ops.""" from zeus.common.class_factory import ClassFactory ClassFactory.lazy_register("zeus.networks.pytorch.ops", { "fmdunit": ["network:FMDUnit", "network:LinearScheduler"], })
# -*- coding:utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # This program is free software; you can redistribute it and/or modify # it under the terms of the MIT License. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MIT License for more details. """Lazy import custom network.""" from zeus.common.class_factory import ClassFactory ClassFactory.lazy_register( "zeus.networks.pytorch.customs", { "nago": ["network:NAGO"], "deepfm": ["network:DeepFactorizationMachineModel"], "autogate": ["network:AutoGateModel"], "autogroup": ["network:AutoGroupModel"], "bisenet": ["network:BiSeNet"], "modnas": ["network:ModNasArchSpace"], "mobilenetv2": ["network:MobileNetV2"], })
from .loss import Loss from zeus.common.class_factory import ClassFactory ClassFactory.lazy_register( "zeus.modules.loss", { "multiloss": ["trainer.loss:MultiLoss"], "focal_loss": ["trainer.loss:FocalLoss"], "f1_loss": ["trainer.loss:F1Loss"], "forecast_loss": ["trainer.loss:ForecastLoss"], "mean_loss": ["trainer.loss:MeanLoss"], "ProbOhemCrossEntropy2d": ["trainer.loss:ProbOhemCrossEntropy2d"], "gan_loss": ["trainer.loss:GANLoss"], })
# -*- coding:utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # This program is free software; you can redistribute it and/or modify # it under the terms of the MIT License. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MIT License for more details. """Lazy import cyclesr bodys.""" from zeus.common.class_factory import ClassFactory ClassFactory.lazy_register("zeus.networks.pytorch.cyclesrbodys", { "cyclesr_net": ["CycleSRModel"], })
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # This program is free software; you can redistribute it and/or modify # it under the terms of the MIT License. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MIT License for more details. """Lazy import dataset.""" from zeus.common.class_factory import ClassFactory ClassFactory.lazy_register("zeus.datasets.common", { "avazu": ["AvazuDataset"], "cifar10": ["Cifar10"], "cifar100": ["Cifar100"], "div2k": ["DIV2K"], "cls_ds": ["ClassificationDataset"], "cityscapes": ["Cityscapes"], "div2k_unpair": ["Div2kUnpair"], "fmnist": ["FashionMnist"], # "imagenet": ["Imagenet"], "mnist": ["Mnist"], "sr_datasets": ["Set5", "Set14", "BSDS100"], "auto_lane_datasets": ["AutoLaneDataset"], "coco": ["CocoDataset"], "mrpc": ["MrpcDataset"], "spatiotemporal": ["SpatiotemporalDataset"] })
ClassFactory.lazy_register("zeus.datasets.transforms", { # common "AutoContrast": ["AutoContrast"], "BboxTransform": ["BboxTransform"], "Brightness": ["Brightness"], "Color": ["Color"], "Compose": ["Compose", "ComposeAll"], "Compose_pair": ["Compose_pair"], "Contrast": ["Contrast"], "Cutout": ["Cutout"], "Equalize": ["Equalize"], "RandomCrop_pair": ["RandomCrop_pair"], "RandomHorizontalFlip_pair": ["RandomHorizontalFlip_pair"], "RandomMirrow_pair": ["RandomMirrow_pair"], "RandomRotate90_pair": ["RandomRotate90_pair"], "RandomVerticallFlip_pair": ["RandomVerticallFlip_pair"], "RandomColor_pair": ["RandomColor_pair"], "RandomRotate_pair": ["RandomRotate_pair"], "Rescale_pair": ["Rescale_pair"], "Normalize_pair": ["Normalize_pair"], # GPU only "ImageTransform": ["ImageTransform"], "Invert": ["Invert"], "MaskTransform": ["MaskTransform"], "Posterize": ["Posterize"], "Rotate": ["Rotate"], "SegMapTransform": ["SegMapTransform"], "Sharpness": ["Sharpness"], "Shear_X": ["Shear_X"], "Shear_Y": ["Shear_Y"], "Solarize": ["Solarize"], "Translate_X": ["Translate_X"], "Translate_Y": ["Translate_Y"], "RandomGaussianBlur_pair": ["RandomGaussianBlur_pair"], "RandomHorizontalFlipWithBoxes": ["RandomHorizontalFlipWithBoxes"], })
# -*- coding:utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # This program is free software; you can redistribute it and/or modify # it under the terms of the MIT License. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MIT License for more details. """Lazy import pytorch blocks.""" from zeus.common.class_factory import ClassFactory ClassFactory.lazy_register("zeus.networks.pytorch.blocks", { "block": ["Block"], "conv_ws": ["ConvWS2d"], "stem": ['PreTwoStem'], })