Giter Site home page Giter Site logo

d2go's Introduction

D2Go

D2Go is a production ready software system from FacebookResearch, which supports end-to-end model training and deployment for mobile platforms.

What's D2Go

  • It is a deep learning toolkit powered by PyTorch and Detectron2.
  • State-of-the-art efficient backbone networks for mobile devices.
  • End-to-end model training, quantization and deployment pipeline.
  • Easy export to TorchScript format for deployment.

Installation

Install PyTorch Nightly (use CUDA 10.2 as example, see details at PyTorch Website):

conda install pytorch torchvision cudatoolkit=10.2 -c pytorch-nightly

Install Detectron2 (other installation options at Detectron2):

python -m pip install 'git+https://github.com/facebookresearch/detectron2.git'

Install mobile_cv:

python -m pip install 'git+https://github.com/facebookresearch/mobile-vision.git'

Install d2go:

git clone https://github.com/facebookresearch/d2go
cd d2go & python -m pip install .

Get Started

License

D2Go is released under the Apache 2.0 license.

d2go's People

Contributors

amyreese avatar ananthsub avatar crassirostris avatar daixl1992 avatar daveboat avatar dspgbgjd avatar facebook-github-bot avatar jacobszwejbka avatar jaconey avatar jerryzh168 avatar jiaxuzhu92 avatar kazhang avatar krishnakumar-kapil avatar leitian avatar mattcyu1 avatar metamate123 avatar miqueljubert avatar newstzpz avatar ppwwyyxx avatar salilsdesai avatar sf-wind avatar sstsai-adl avatar stephenyan1231 avatar tangbinh avatar tannergilbert avatar valentinandrei avatar wat3rbro avatar xiaoliangdai avatar ynonaolga avatar zhanghang1989 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

d2go's Issues

AttributeError: module 'detr' has no attribute 'datasets'

Hi, thanks for your great work!
An error occured when I follow the instruction of detr subproject.
I ran the command as instructed in detr readme

:~/d2go$ python tools/train_net.py --runner detr.runner.DETRRunner  --config projects_oss/detr/configs/deformable_detr_fbnetv3a_bs16.yaml

Then an error occured:

** fvcore version of PathManager will be deprecated soon. **
** Please migrate to the version in iopath repo. **
https://github.com/facebookresearch/iopath

Namespace(config_file='projects_oss/detr/configs/deformable_detr_fbnetv3a_bs16.yaml', dist_backend='NCCL', dist_url='file:///tmp/d2go_dist_file_1615526898.7341282', eval_only=False, machine_rank=0, num_machines=1, num_processes=1, opts=[], output_dir=None, resume=False, runner='detr.runner.DETRRunner')
Traceback (most recent call last):
  File "tools/train_net.py", line 104, in <module>
    cli()
  File "tools/train_net.py", line 101, in cli
    run_with_cmdline_args(parser.parse_args())
  File "tools/train_net.py", line 80, in run_with_cmdline_args
    cfg, output_dir, runner = prepare_for_launch(args)
  File "/home/lbc/anaconda3/envs/d2go/lib/python3.6/site-packages/d2go/setup.py", line 165, in prepare_for_launch
    runner = create_runner(args.runner)
  File "/home/lbc/anaconda3/envs/d2go/lib/python3.6/site-packages/d2go/runner/__init__.py", line 20, in create_runner
    runner_class = get_class(class_full_name)
  File "/home/lbc/anaconda3/envs/d2go/lib/python3.6/site-packages/d2go/runner/__init__.py", line 13, in get_class
    runner_module = importlib.import_module(runner_module_name)
  File "/home/lbc/anaconda3/envs/d2go/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/lbc/anaconda3/envs/d2go/lib/python3.6/site-packages/detr-0.0.0-py3.6-linux-x86_64.egg/detr/__init__.py", line 3, in <module>
    from . import models, util, datasets
  File "/home/lbc/anaconda3/envs/d2go/lib/python3.6/site-packages/detr-0.0.0-py3.6-linux-x86_64.egg/detr/datasets/__init__.py", line 7, in <module>
    from .coco import build as build_coco
  File "/home/lbc/anaconda3/envs/d2go/lib/python3.6/site-packages/detr-0.0.0-py3.6-linux-x86_64.egg/detr/datasets/coco.py", line 16, in <module>
    import detr.datasets.transforms as T
AttributeError: module 'detr' has no attribute 'datasets'

KeyError "trunk" when getting model based on architecture

Setting cfg.MODEL.FBNET_V2.ARCH = "default" yields KeyError: 'trunk4'
and setting

cfg.MODEL.FBNET_V2.ARCH_DEF = CfgNode({"default": {
"trunk": DEFAULT_STAGES[0:4],
"rpn": [[_repeat_last(DEFAULT_STAGES[3])]],
"bbox": LARGE_BOX_HEAD_STAGES,
"mask": LARGE_UPSAMPLE_HEAD_STAGES,
"kpts": LARGE_UPSAMPLE_HEAD_STAGES,
"basic_args": _BASIC_ARGS}})
cfg.MODEL.FBNET_V2.ARCH = None" 

yields arch_def = {name: arch_def[name]} KeyError: 'trunk'
This is KeyError happends for any model defined in
https://github.com/facebookresearch/d2go/blob/master/d2go/modeling/modeldef/modeldef.py#L425

Export mask_rcnn to Int8 Model (Floating Point exception)

I was using Export model to Int8 Model using from demo/d2go_beginner.ipynb for mask_rcnn model, exact code:

import copy
from detectron2.data import build_detection_test_loader
from d2go.model_zoo import model_zoo
from d2go.export.api import convert_and_export_predictor
from d2go.utils.testing.data_loader_helper import create_fake_detection_data_loader
from d2go.export.d2_meta_arch import patch_d2_meta_arch

import logging

# disable all the warnings
previous_level = logging.root.manager.disable
logging.disable(logging.INFO)

patch_d2_meta_arch()

cfg_name = 'mask_rcnn_fbnetv3a_dsmask_C4.yaml'
pytorch_model = model_zoo.get(cfg_name, trained=True)
pytorch_model.cpu()

with create_fake_detection_data_loader(224, 320, is_train=False) as data_loader:
    predictor_path = convert_and_export_predictor(
            model_zoo.get_config(cfg_name),
            copy.deepcopy(pytorch_model),
            "torchscript_int8@tracing",
            './',
            data_loader,
        )

# recover the logging level
logging.disable(previous_level)

Then python gives terminated by signal SIGFPE (Floating point exception)

Before the error, there were no other error, but these warnings:
Arguments ['width_divisor', 'dw_skip_bnrelu', 'zero_last_bn_gamma'] skipped for op Conv2d Some model parameters or buffers are not found in the checkpoint: roi_heads.mask_head.feature_extractor.0.fbnetv2_0_0.dw.conv.weight roi_heads.mask_head.feature_extractor.0.fbnetv2_0_0.pw.bn.{bias, running_mean, running_var, weight} roi_heads.mask_head.feature_extractor.0.fbnetv2_0_0.pw.conv.weight roi_heads.mask_head.feature_extractor.0.fbnetv2_0_0.pwl.bn.{bias, running_mean, running_var, weight} roi_heads.mask_head.feature_extractor.0.fbnetv2_0_0.pwl.conv.weight roi_heads.mask_head.feature_extractor.0.fbnetv2_0_1.dw.conv.weight roi_heads.mask_head.feature_extractor.0.fbnetv2_0_1.pw.bn.{bias, running_mean, running_var, weight} roi_heads.mask_head.feature_extractor.0.fbnetv2_0_1.pw.conv.weight roi_heads.mask_head.feature_extractor.0.fbnetv2_0_1.pwl.bn.{bias, running_mean, running_var, weight} roi_heads.mask_head.feature_extractor.0.fbnetv2_0_1.pwl.conv.weight roi_heads.mask_head.feature_extractor.0.fbnetv2_0_2.dw.conv.weight roi_heads.mask_head.feature_extractor.0.fbnetv2_0_2.pw.bn.{bias, running_mean, running_var, weight} roi_heads.mask_head.feature_extractor.0.fbnetv2_0_2.pw.conv.weight roi_heads.mask_head.feature_extractor.0.fbnetv2_0_2.pwl.bn.{bias, running_mean, running_var, weight} roi_heads.mask_head.feature_extractor.0.fbnetv2_0_2.pwl.conv.weight roi_heads.mask_head.feature_extractor.0.fbnetv2_0_3.dw.conv.weight roi_heads.mask_head.feature_extractor.0.fbnetv2_0_3.pw.bn.{bias, running_mean, running_var, weight} roi_heads.mask_head.feature_extractor.0.fbnetv2_0_3.pw.conv.weight roi_heads.mask_head.feature_extractor.0.fbnetv2_0_3.pwl.bn.{bias, running_mean, running_var, weight} roi_heads.mask_head.feature_extractor.0.fbnetv2_0_3.pwl.conv.weight roi_heads.mask_head.feature_extractor.0.fbnetv2_0_4.dw.conv.weight roi_heads.mask_head.feature_extractor.0.fbnetv2_0_4.pw.bn.{bias, running_mean, running_var, weight} roi_heads.mask_head.feature_extractor.0.fbnetv2_0_4.pw.conv.weight roi_heads.mask_head.feature_extractor.0.fbnetv2_0_4.pwl.bn.{bias, running_mean, running_var, weight} roi_heads.mask_head.feature_extractor.0.fbnetv2_0_4.pwl.conv.weight roi_heads.mask_head.predictor.mask_fcn_logits.{bias, weight} The checkpoint state_dict contains keys that are not used by the model: pixel_mean pixel_std proposal_generator.anchor_generator.cell_anchors.0 roi_heads.mask_head.mask_fcn1.weight roi_heads.mask_head.mask_fcn1.norm.{bias, num_batches_tracked, running_mean, running_var, weight} roi_heads.mask_head.mask_fcn2.weight roi_heads.mask_head.mask_fcn2.norm.{bias, num_batches_tracked, running_mean, running_var, weight} roi_heads.mask_head.mask_fcn3.weight roi_heads.mask_head.mask_fcn3.norm.{bias, num_batches_tracked, running_mean, running_var, weight} roi_heads.mask_head.mask_fcn4.weight roi_heads.mask_head.mask_fcn4.norm.{bias, num_batches_tracked, running_mean, running_var, weight} roi_heads.mask_head.deconv.{bias, weight} roi_heads.mask_head.predictor.{bias, weight} loading annotations into memory... Done (t=0.00s) creating index... index created! /home/elbek/anaconda3/envs/d2go/lib/python3.8/site-packages/torch/quantization/observer.py:121: UserWarning: Please use quant_min and quant_max to specify the range for observers. reduce_range will be deprecated in a future release of PyTorch. warnings.warn( /home/elbek/anaconda3/envs/d2go/lib/python3.8/site-packages/torch/quantization/observer.py:955: UserWarning: must run observer before calling calculate_qparams. Returning default scale and zero point warnings.warn( /home/elbek/anaconda3/envs/d2go/lib/python3.8/site-packages/detectron2/structures/image_list.py:92: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! assert t.shape[:-2] == tensors[0].shape[:-2], t.shape /home/elbek/anaconda3/envs/d2go/lib/python3.8/site-packages/detectron2/structures/boxes.py:158: TracerWarning: torch.as_tensor results are registered as constants in the trace. You can safely ignore this warning if you use this function to create tensors out of constant variables that would be the same every time you call this function. In any other case, this might cause the trace to be incorrect. tensor = torch.as_tensor(tensor, dtype=torch.float32, device=device) /home/elbek/anaconda3/envs/d2go/lib/python3.8/site-packages/detectron2/structures/boxes.py:163: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! assert tensor.dim() == 2 and tensor.size(-1) == 4, tensor.size() /home/elbek/anaconda3/envs/d2go/lib/python3.8/site-packages/detectron2/modeling/proposal_generator/proposal_utils.py:101: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! if not valid_mask.all(): /home/elbek/anaconda3/envs/d2go/lib/python3.8/site-packages/detectron2/structures/boxes.py:200: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! assert torch.isfinite(self.tensor).all(), "Box tensor contains infinite or NaN!" /home/elbek/anaconda3/envs/d2go/lib/python3.8/site-packages/torch/tensor.py:587: RuntimeWarning: Iterating over a tensor might cause the trace to be incorrect. Passing a tensor of different shape won't change the number of iterations executed (and might lead to errors or silently give incorrect results). warnings.warn('Iterating over a tensor might cause the trace to be incorrect. ' /home/elbek/anaconda3/envs/d2go/lib/python3.8/site-packages/detectron2/layers/nms.py:25: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! assert boxes.shape[-1] == 4 /home/elbek/anaconda3/envs/d2go/lib/python3.8/site-packages/detectron2/modeling/poolers.py:216: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! assert len(box_lists) == x[0].size( /home/elbek/anaconda3/envs/d2go/lib/python3.8/site-packages/detectron2/layers/roi_align.py:55: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! assert rois.dim() == 2 and rois.size(1) == 5 /home/elbek/Projects/playground/test/d2go/d2go/modeling/backbone/fbnet_v2.py:372: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! if len(x.shape) == 4 and (x.shape[2] > 1 or x.shape[3] > 1): /home/elbek/anaconda3/envs/d2go/lib/python3.8/site-packages/detectron2/modeling/roi_heads/fast_rcnn.py:138: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! if not valid_mask.all(): /home/elbek/anaconda3/envs/d2go/lib/python3.8/site-packages/detectron2/modeling/roi_heads/fast_rcnn.py:155: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! if num_bbox_reg_classes == 1:

AttributeError: module 'torch.nn' has no attribute 'Hardswish' on Raspberry Pi

AttributeError: module 'torch.nn' has no attribute 'Hardswish' on Raspberry Pi

  1. from d2go.model_zoo import model_zoo gives AttributeError: module 'torch.nn' has no attribute 'Hardswish'
  2. from d2go.model_zoo import model_zoo
  3. Full logs or other relevant observations:
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-ffdbfe040df2> in <module>
----> 1 from d2go.model_zoo import model_zoo
      2 model = model_zoo.get('faster_rcnn_fbnetv3a_C4.yaml', trained=True)

~/.local/lib/python3.7/site-packages/d2go/__init__.py in <module>
      5 # Set up custom environment before nearly anything else is imported
      6 # NOTE: this should be the first import (no not reorder)
----> 7 from d2go import initializer, optimizer  # NOQA

~/.local/lib/python3.7/site-packages/d2go/initializer.py in <module>
     64 _INITIALIZED = False
     65 if not _INITIALIZED:
---> 66     initialize_all()
     67     _INITIALIZED = True

~/.local/lib/python3.7/site-packages/d2go/initializer.py in initialize_all()
     59     _setup_env()
     60     _register_d2_datasets()
---> 61     _register()
     62 
     63 

~/.local/lib/python3.7/site-packages/d2go/initializer.py in timed_f(*args, **kwargs)
     15         def timed_f(*args, **kwargs):
     16             start = time.perf_counter()
---> 17             ret = f(*args, **kwargs)
     18             time_list.append(time.perf_counter() - start)
     19             return ret

~/.local/lib/python3.7/site-packages/d2go/initializer.py in _register()
     41 @_record_times(REGISTER_TIME)
     42 def _register():
---> 43     from d2go.modeling.backbone import (  # NOQA
     44         fbnet_v2,
     45     )

~/.local/lib/python3.7/site-packages/d2go/modeling/backbone/fbnet_v2.py in <module>
     20 from detectron2.modeling.roi_heads import box_head, keypoint_head, mask_head
     21 from detectron2.utils.logger import log_first_n
---> 22 from mobile_cv.arch.fbnet_v2 import fbnet_builder as mbuilder
     23 from d2go.modeling.modeldef.fbnet_modeldef_registry import FBNetV2ModelArch
     24 from mobile_cv.arch.utils.helper import format_dict_expanding_list_values

~/.local/lib/python3.7/site-packages/mobile_cv/arch/fbnet_v2/fbnet_builder.py in <module>
    140 import torch.nn as nn
    141 
--> 142 from .blocks_factory import PRIMITIVES
    143 
    144 

~/.local/lib/python3.7/site-packages/mobile_cv/arch/fbnet_v2/blocks_factory.py in <module>
     10 from torch import nn
     11 
---> 12 from . import basic_blocks as bb, irf_block
     13 
     14 

~/.local/lib/python3.7/site-packages/mobile_cv/arch/fbnet_v2/basic_blocks.py in <module>
    227 
    228 
--> 229 HSwish = torch.nn.Hardswish
    230 
    231 

AttributeError: module 'torch.nn' has no attribute 'Hardswish'

Issue template

Hi there,
Motivated by detectron2, I suggest setting up issue template for this repo.
What do you think?

The performance of the original deformable DETR is not replicable

Hi,

I want to check if this implementation can replicate the performance of the original deformable DETR (with ResNet-50 on COCO), but I couldn't match the performance.

replication w/ [the original code]:
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.437
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.627
Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.475

replication w/ this repo (using the configs below):
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.413
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.599
Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.450

Could you confirm if your code can replicate the original deformable DETR performance?
It would be great if you provide a fix on my configs below, or just your configs to replicate it.


Here are the configs I added/modified in [the fbnet config file] to get the performances above:

MODEL:
  WEIGHTS: "R-50.pkl"
  BACKBONE:
    NAME: "build_resnet_backbone"
  RESNETS:
    DEFORM_MODULATED: False
    DEFORM_NUM_GROUPS: 1
    DEFORM_ON_PER_STAGE: [False, False, False, False]
    DEPTH: 50
    NORM: FrozenBN
    NUM_GROUPS: 1
    OUT_FEATURES: ['res3', 'res4', 'res5']
    RES2_OUT_CHANNELS: 256
    RES5_DILATION: 1
    STEM_OUT_CHANNELS: 64
    STRIDE_IN_1X1: True
    WIDTH_PER_GROUP: 64
  DETR:
    NUM_FEATURE_LEVELS: 4
SOLVER:
  STEPS: (295680,)
  MAX_ITER: 369600

The resnet configs are mostly from [the default detectron2 config].
I used 8 gpus to train this model, which takes ~2 days for training.

Quantization-aware training with the API

Instructions To Reproduce the ๐Ÿ› Bug:

I tried to add quantization-aware training to the d2go_beginner.ipynb notebook, but I couldn't get it to work.

Code:

from d2go.runner import Detectron2GoRunner


def prepare_for_launch():
    runner = Detectron2GoRunner()
    cfg = runner.get_default_cfg()
    cfg.merge_from_file(model_zoo.get_config_file("faster_rcnn_fbnetv3a_C4.yaml"))
    cfg.MODEL_EMA.ENABLED = False
    cfg.DATASETS.TRAIN = ("balloon_train",)
    cfg.DATASETS.TEST = ("balloon_val",)
    cfg.DATALOADER.NUM_WORKERS = 2
    cfg.MODEL.WEIGHTS = model_zoo.get_checkpoint_url("faster_rcnn_fbnetv3a_C4.yaml")  # Let training initialize from model zoo
    cfg.SOLVER.IMS_PER_BATCH = 2
    cfg.SOLVER.BASE_LR = 0.00025  # pick a good LR
    cfg.SOLVER.MAX_ITER = 600    # 300 iterations seems good enough for this toy dataset; you will need to train longer for a practical dataset
    cfg.SOLVER.STEPS = []        # do not decay learning rate
    cfg.MODEL.ROI_HEADS.BATCH_SIZE_PER_IMAGE = 128   # faster, and good enough for this toy dataset (default: 512)
    cfg.MODEL.ROI_HEADS.NUM_CLASSES = 1  # only has one class (ballon). (see https://detectron2.readthedocs.io/tutorials/datasets.html#update-the-config-for-new-datasets)
    # NOTE: this config means the number of classes, but a few popular unofficial tutorials incorrect uses num_classes+1 here.

    # quantization-aware training
    cfg.QUANTIZATION.BACKEND = "qnnpack"
    cfg.QUANTIZATION.QAT.ENABLED = True
    cfg.QUANTIZATION.QAT.START_ITER = 0
    cfg.QUANTIZATION.QAT.ENABLE_OBSERVER_ITER = 0
    cfg.QUANTIZATION.QAT.DISABLE_OBSERVER_ITER = 5
    cfg.QUANTIZATION.QAT.FREEZE_BN_ITER = 7

    os.makedirs(cfg.OUTPUT_DIR, exist_ok=True)
    return cfg, runner

cfg, runner = prepare_for_launch()
print(cfg)
model = runner.build_model(cfg)
runner.do_train(cfg, model, resume=False)

Error message:

AssertionError                            Traceback (most recent call last)
<ipython-input-11-327fe2b2a9ce> in <module>()
     32 cfg, runner = prepare_for_launch()
     33 print(cfg)
---> 34 model = runner.build_model(cfg)
     35 runner.do_train(cfg, model, resume=False)

15 frames
/usr/local/lib/python3.7/dist-packages/torch/quantization/fuser_method_mappings.py in get_fuser_method(op_list, additional_fuser_method_mapping)
    129                                      additional_fuser_method_mapping)
    130     fuser_method = all_mappings.get(op_list, None)
--> 131     assert fuser_method is not None, "did not find fuser method for: {} ".format(op_list)
    132     return fuser_method

AssertionError: did not find fuser method for: (<class 'torch.nn.modules.conv.Conv2d'>, <class 'mobile_cv.arch.layers.batch_norm.NaiveSyncBatchNorm'>, <class 'torch.nn.modules.activation.ReLU'>) 

Expected behavior:

Quantization-aware training should work with the API.

Warmup not behaving as expected when MAX_ITER equals WARMUP_ITERS

Instructions To Reproduce the ๐Ÿ› Bug:

I ran the d2go_beginner.ipynb notebook with different parameters for MAX_ITER and WARMUP_ITERS and noticed that the warmup isn't behaving as expected when the MAX_ITER and WARMUP_ITERS are the same.

cfg.SOLVER.MAX_ITER = 300
cfg.SOLVER.WARMUP_ITERS = 300

[03/15 07:45:34 d2.engine.train_loop]: Starting training from iteration 0
[03/15 07:45:41 d2.utils.events]:  eta: 0:01:18  iter: 19  total_loss: 1.511  loss_cls: 0.7482  loss_box_reg: 0.6615  loss_rpn_cls: 0.07748  loss_rpn_loc: 0.004672  time: 0.2877  data_time: 0.0751  lr: 2.3417e-07  max_mem: 824M
[03/15 07:45:47 d2.utils.events]:  eta: 0:01:16  iter: 39  total_loss: 1.378  loss_cls: 0.7411  loss_box_reg: 0.5793  loss_rpn_cls: 0.06518  loss_rpn_loc: 0.006204  time: 0.2989  data_time: 0.0267  lr: 2.175e-07  max_mem: 824M
[03/15 07:45:53 d2.utils.events]:  eta: 0:01:09  iter: 59  total_loss: 1.466  loss_cls: 0.7474  loss_box_reg: 0.6219  loss_rpn_cls: 0.1009  loss_rpn_loc: 0.003633  time: 0.3002  data_time: 0.0356  lr: 2.0083e-07  max_mem: 824M
[03/15 07:46:00 d2.utils.events]:  eta: 0:01:04  iter: 79  total_loss: 1.302  loss_cls: 0.7414  loss_box_reg: 0.5261  loss_rpn_cls: 0.0558  loss_rpn_loc: 0.005096  time: 0.3029  data_time: 0.0323  lr: 1.8417e-07  max_mem: 824M
[03/15 07:46:06 d2.utils.events]:  eta: 0:00:58  iter: 99  total_loss: 1.465  loss_cls: 0.7448  loss_box_reg: 0.5934  loss_rpn_cls: 0.1072  loss_rpn_loc: 0.007506  time: 0.3037  data_time: 0.0311  lr: 1.675e-07  max_mem: 824M
[03/15 07:46:12 d2.utils.events]:  eta: 0:00:52  iter: 119  total_loss: 1.488  loss_cls: 0.7404  loss_box_reg: 0.6718  loss_rpn_cls: 0.06868  loss_rpn_loc: 0.004564  time: 0.3030  data_time: 0.0291  lr: 1.5083e-07  max_mem: 824M
[03/15 07:46:18 d2.utils.events]:  eta: 0:00:46  iter: 139  total_loss: 1.506  loss_cls: 0.7359  loss_box_reg: 0.6465  loss_rpn_cls: 0.09168  loss_rpn_loc: 0.004458  time: 0.3051  data_time: 0.0373  lr: 1.3417e-07  max_mem: 824M
[03/15 07:46:24 d2.utils.events]:  eta: 0:00:40  iter: 159  total_loss: 1.482  loss_cls: 0.7399  loss_box_reg: 0.6413  loss_rpn_cls: 0.09116  loss_rpn_loc: 0.005752  time: 0.3047  data_time: 0.0283  lr: 1.175e-07  max_mem: 824M
[03/15 07:46:30 d2.utils.events]:  eta: 0:00:34  iter: 179  total_loss: 1.448  loss_cls: 0.7357  loss_box_reg: 0.5968  loss_rpn_cls: 0.08184  loss_rpn_loc: 0.004848  time: 0.3025  data_time: 0.0136  lr: 1.0083e-07  max_mem: 824M
[03/15 07:46:35 d2.utils.events]:  eta: 0:00:28  iter: 199  total_loss: 1.373  loss_cls: 0.7373  loss_box_reg: 0.5676  loss_rpn_cls: 0.06744  loss_rpn_loc: 0.004275  time: 0.2999  data_time: 0.0157  lr: 8.4167e-08  max_mem: 824M
[03/15 07:46:41 d2.utils.events]:  eta: 0:00:22  iter: 219  total_loss: 1.472  loss_cls: 0.7368  loss_box_reg: 0.6052  loss_rpn_cls: 0.08157  loss_rpn_loc: 0.007896  time: 0.2991  data_time: 0.0196  lr: 6.75e-08  max_mem: 824M
[03/15 07:46:47 d2.utils.events]:  eta: 0:00:16  iter: 239  total_loss: 1.434  loss_cls: 0.7317  loss_box_reg: 0.6189  loss_rpn_cls: 0.08527  loss_rpn_loc: 0.004734  time: 0.2977  data_time: 0.0154  lr: 5.0833e-08  max_mem: 824M
[03/15 07:46:53 d2.utils.events]:  eta: 0:00:11  iter: 259  total_loss: 1.561  loss_cls: 0.7341  loss_box_reg: 0.6562  loss_rpn_cls: 0.1202  loss_rpn_loc: 0.008203  time: 0.2967  data_time: 0.0143  lr: 3.4167e-08  max_mem: 824M
[03/15 07:46:58 d2.utils.events]:  eta: 0:00:05  iter: 279  total_loss: 1.385  loss_cls: 0.7374  loss_box_reg: 0.5143  loss_rpn_cls: 0.08217  loss_rpn_loc: 0.004046  time: 0.2959  data_time: 0.0107  lr: 1.75e-08  max_mem: 824M
[03/15 07:47:04 d2.utils.events]:  eta: 0:00:00  iter: 299  total_loss: 1.504  loss_cls: 0.7353  loss_box_reg: 0.6385  loss_rpn_cls: 0.07915  loss_rpn_loc: 0.004035  time: 0.2956  data_time: 0.0188  lr: 8.3333e-10  max_mem: 824M
[03/15 07:47:04 d2.engine.hooks]: Overall training speed: 298 iterations in 0:01:28 (0.2956 s / it)

Expected behavior: The learning rate should increase for the 300 iterations, but it decreases for all of them.

cfg.SOLVER.MAX_ITER = 300
cfg.SOLVER.WARMUP_ITERS = 200

[03/15 07:47:57 d2.engine.train_loop]: Starting training from iteration 0
[03/15 07:48:04 d2.utils.events]:  eta: 0:01:23  iter: 19  total_loss: 1.475  loss_cls: 0.7214  loss_box_reg: 0.6375  loss_rpn_cls: 0.07351  loss_rpn_loc: 0.004179  time: 0.2951  data_time: 0.0589  lr: 6.1638e-06  max_mem: 824M
[03/15 07:48:10 d2.utils.events]:  eta: 0:01:17  iter: 39  total_loss: 1.383  loss_cls: 0.7036  loss_box_reg: 0.5085  loss_rpn_cls: 0.08158  loss_rpn_loc: 0.004653  time: 0.3084  data_time: 0.0369  lr: 1.2389e-05  max_mem: 824M
[03/15 07:48:16 d2.utils.events]:  eta: 0:01:09  iter: 59  total_loss: 1.339  loss_cls: 0.6572  loss_box_reg: 0.6244  loss_rpn_cls: 0.07994  loss_rpn_loc: 0.005873  time: 0.3054  data_time: 0.0348  lr: 1.8614e-05  max_mem: 824M
[03/15 07:48:22 d2.utils.events]:  eta: 0:01:04  iter: 79  total_loss: 1.348  loss_cls: 0.606  loss_box_reg: 0.6746  loss_rpn_cls: 0.09816  loss_rpn_loc: 0.004536  time: 0.3071  data_time: 0.0296  lr: 2.4839e-05  max_mem: 824M
[03/15 07:48:29 d2.utils.events]:  eta: 0:00:58  iter: 99  total_loss: 1.163  loss_cls: 0.5328  loss_box_reg: 0.5132  loss_rpn_cls: 0.07843  loss_rpn_loc: 0.00285  time: 0.3080  data_time: 0.0389  lr: 3.1064e-05  max_mem: 824M
[03/15 07:48:35 d2.utils.events]:  eta: 0:00:51  iter: 119  total_loss: 1.164  loss_cls: 0.4873  loss_box_reg: 0.5667  loss_rpn_cls: 0.07308  loss_rpn_loc: 0.006637  time: 0.3065  data_time: 0.0326  lr: 3.7289e-05  max_mem: 824M
[03/15 07:48:41 d2.utils.events]:  eta: 0:00:46  iter: 139  total_loss: 1.1  loss_cls: 0.4221  loss_box_reg: 0.556  loss_rpn_cls: 0.08379  loss_rpn_loc: 0.007661  time: 0.3070  data_time: 0.0390  lr: 4.3514e-05  max_mem: 824M
[03/15 07:48:47 d2.utils.events]:  eta: 0:00:40  iter: 159  total_loss: 1.017  loss_cls: 0.3673  loss_box_reg: 0.6014  loss_rpn_cls: 0.07597  loss_rpn_loc: 0.004442  time: 0.3065  data_time: 0.0340  lr: 4.9739e-05  max_mem: 824M
[03/15 07:48:53 d2.utils.events]:  eta: 0:00:34  iter: 179  total_loss: 0.9074  loss_cls: 0.3243  loss_box_reg: 0.4583  loss_rpn_cls: 0.06661  loss_rpn_loc: 0.003071  time: 0.3054  data_time: 0.0164  lr: 5.5964e-05  max_mem: 824M
[03/15 07:48:59 d2.utils.events]:  eta: 0:00:28  iter: 199  total_loss: 0.8592  loss_cls: 0.2855  loss_box_reg: 0.5189  loss_rpn_cls: 0.06242  loss_rpn_loc: 0.00466  time: 0.3042  data_time: 0.0115  lr: 6.2189e-05  max_mem: 824M
[03/15 07:49:04 d2.utils.events]:  eta: 0:00:22  iter: 219  total_loss: 0.8483  loss_cls: 0.2551  loss_box_reg: 0.5251  loss_rpn_cls: 0.06068  loss_rpn_loc: 0.004112  time: 0.3026  data_time: 0.0195  lr: 4.2336e-05  max_mem: 824M
[03/15 07:49:10 d2.utils.events]:  eta: 0:00:17  iter: 239  total_loss: 0.781  loss_cls: 0.2411  loss_box_reg: 0.4754  loss_rpn_cls: 0.04682  loss_rpn_loc: 0.004127  time: 0.3017  data_time: 0.0266  lr: 2.4648e-05  max_mem: 824M
[03/15 07:49:16 d2.utils.events]:  eta: 0:00:11  iter: 259  total_loss: 0.6583  loss_cls: 0.2059  loss_box_reg: 0.4139  loss_rpn_cls: 0.05403  loss_rpn_loc: 0.002323  time: 0.3009  data_time: 0.0160  lr: 1.1345e-05  max_mem: 824M
[03/15 07:49:22 d2.utils.events]:  eta: 0:00:05  iter: 279  total_loss: 0.8424  loss_cls: 0.2537  loss_box_reg: 0.5407  loss_rpn_cls: 0.03735  loss_rpn_loc: 0.007523  time: 0.3000  data_time: 0.0180  lr: 3.0104e-06  max_mem: 824M
[03/15 07:49:28 d2.utils.events]:  eta: 0:00:00  iter: 299  total_loss: 0.8198  loss_cls: 0.2144  loss_box_reg: 0.5238  loss_rpn_cls: 0.05783  loss_rpn_loc: 0.003637  time: 0.2999  data_time: 0.0183  lr: 6.8538e-09  max_mem: 824M
[03/15 07:49:29 d2.engine.hooks]: Overall training speed: 298 iterations in 0:01:29 (0.2999 s / it)

cfg.SOLVER.MAX_ITER = 300
cfg.SOLVER.WARMUP_ITERS = 400

[03/15 07:50:35 d2.engine.train_loop]: Starting training from iteration 0
[03/15 07:50:42 d2.utils.events]:  eta: 0:01:22  iter: 19  total_loss: 1.431  loss_cls: 0.7136  loss_box_reg: 0.6018  loss_rpn_cls: 0.07154  loss_rpn_loc: 0.004235  time: 0.2938  data_time: 0.0633  lr: 3.2069e-06  max_mem: 824M
[03/15 07:50:48 d2.utils.events]:  eta: 0:01:16  iter: 39  total_loss: 1.42  loss_cls: 0.7006  loss_box_reg: 0.5822  loss_rpn_cls: 0.08506  loss_rpn_loc: 0.004087  time: 0.3077  data_time: 0.0471  lr: 6.3194e-06  max_mem: 824M
[03/15 07:50:54 d2.utils.events]:  eta: 0:01:07  iter: 59  total_loss: 1.32  loss_cls: 0.6825  loss_box_reg: 0.5126  loss_rpn_cls: 0.08818  loss_rpn_loc: 0.00636  time: 0.3012  data_time: 0.0291  lr: 9.4319e-06  max_mem: 824M
[03/15 07:51:00 d2.utils.events]:  eta: 0:01:02  iter: 79  total_loss: 1.407  loss_cls: 0.6416  loss_box_reg: 0.6176  loss_rpn_cls: 0.08065  loss_rpn_loc: 0.003985  time: 0.3022  data_time: 0.0286  lr: 1.2544e-05  max_mem: 824M
[03/15 07:51:06 d2.utils.events]:  eta: 0:00:56  iter: 99  total_loss: 1.387  loss_cls: 0.6129  loss_box_reg: 0.6034  loss_rpn_cls: 0.09336  loss_rpn_loc: 0.008762  time: 0.3014  data_time: 0.0290  lr: 1.5657e-05  max_mem: 824M
[03/15 07:51:12 d2.utils.events]:  eta: 0:00:51  iter: 119  total_loss: 1.195  loss_cls: 0.5624  loss_box_reg: 0.5371  loss_rpn_cls: 0.08053  loss_rpn_loc: 0.00402  time: 0.3044  data_time: 0.0419  lr: 1.8769e-05  max_mem: 824M
[03/15 07:51:19 d2.utils.events]:  eta: 0:00:45  iter: 139  total_loss: 1.186  loss_cls: 0.5251  loss_box_reg: 0.5488  loss_rpn_cls: 0.09642  loss_rpn_loc: 0.007399  time: 0.3054  data_time: 0.0439  lr: 2.1882e-05  max_mem: 824M
[03/15 07:51:25 d2.utils.events]:  eta: 0:00:39  iter: 159  total_loss: 1.208  loss_cls: 0.4767  loss_box_reg: 0.6493  loss_rpn_cls: 0.08588  loss_rpn_loc: 0.003245  time: 0.3063  data_time: 0.0429  lr: 2.4994e-05  max_mem: 824M
[03/15 07:51:31 d2.utils.events]:  eta: 0:00:33  iter: 179  total_loss: 1.143  loss_cls: 0.4499  loss_box_reg: 0.5675  loss_rpn_cls: 0.07869  loss_rpn_loc: 0.006942  time: 0.3044  data_time: 0.0123  lr: 2.8107e-05  max_mem: 824M
[03/15 07:51:37 d2.utils.events]:  eta: 0:00:28  iter: 199  total_loss: 1.062  loss_cls: 0.403  loss_box_reg: 0.5842  loss_rpn_cls: 0.05503  loss_rpn_loc: 0.00431  time: 0.3029  data_time: 0.0135  lr: 3.1219e-05  max_mem: 824M
[03/15 07:51:42 d2.utils.events]:  eta: 0:00:22  iter: 219  total_loss: 1.197  loss_cls: 0.3878  loss_box_reg: 0.6243  loss_rpn_cls: 0.0716  loss_rpn_loc: 0.006711  time: 0.3007  data_time: 0.0125  lr: 3.4332e-05  max_mem: 824M
[03/15 07:51:48 d2.utils.events]:  eta: 0:00:16  iter: 239  total_loss: 0.9984  loss_cls: 0.342  loss_box_reg: 0.5484  loss_rpn_cls: 0.06528  loss_rpn_loc: 0.00512  time: 0.2997  data_time: 0.0155  lr: 3.7444e-05  max_mem: 824M
[03/15 07:51:54 d2.utils.events]:  eta: 0:00:11  iter: 259  total_loss: 0.8842  loss_cls: 0.3013  loss_box_reg: 0.5176  loss_rpn_cls: 0.0566  loss_rpn_loc: 0.003898  time: 0.2993  data_time: 0.0170  lr: 4.0557e-05  max_mem: 824M
[03/15 07:52:00 d2.utils.events]:  eta: 0:00:05  iter: 279  total_loss: 0.806  loss_cls: 0.2773  loss_box_reg: 0.4805  loss_rpn_cls: 0.04794  loss_rpn_loc: 0.004214  time: 0.2994  data_time: 0.0272  lr: 4.3669e-05  max_mem: 824M
[03/15 07:52:06 d2.utils.events]:  eta: 0:00:00  iter: 299  total_loss: 0.8269  loss_cls: 0.2697  loss_box_reg: 0.5108  loss_rpn_cls: 0.05376  loss_rpn_loc: 0.003728  time: 0.2975  data_time: 0.0137  lr: 4.6782e-05  max_mem: 824M
[03/15 07:52:07 d2.engine.hooks]: Overall training speed: 298 iterations in 0:01:28 (0.2976 s / it)

Expected behavior:

It seems that warmup doesn't work correctly when MAX_ITER and WARMUP_ITERS are the same.

demo failed

Demo doc suggests to run the following - it fails.

$ python3 demo.py --config-file faster_rcnn_fbnetv3a_C4.yaml --input input1.jpg --output output1.jpg
WARNING:root:This caffe2 python run failed to load cuda module:No module named 'caffe2.python.caffe2_pybind11_state_gpu',and AMD hip module:No module named 'caffe2.python.caffe2_pybind11_state_hip'.Will run in CPU only mode.
[04/13 15:59:54 detectron2]: Arguments: Namespace(confidence_threshold=0.5, config_file='faster_rcnn_fbnetv3a_C4.yaml', input=['input1.jpg'], opts=[], output='output1.jpg', video_input=None, webcam=False)
WARNING:mobile_cv.arch.utils.helper:Arguments ['width_divisor', 'dw_skip_bnrelu', 'zero_last_bn_gamma'] skipped for op Conv2d
[04/13 15:59:55 fvcore.common.checkpoint]: Loading checkpoint from https://mobile-cv.s3-us-west-2.amazonaws.com/d2go/models/246823121/model_0479999.pth
model_0479999.pth: 64.4MB [00:11, 5.62MB/s]                                                                                                                                                   
[04/13 16:00:06 fvcore.common.checkpoint]: The checkpoint state_dict contains keys that are not used by the model:
  pixel_mean
  pixel_std
Traceback (most recent call last):
  File "demo.py", line 150, in <module>
    main()
  File "demo.py", line 81, in main
    assert args.input, "The input path(s) was not found"
AssertionError: The input path(s) was not found

ImportError: Cannot dynamically locate d2go.utils.export_utils.D2RCNNTracingWrapper.RunFunc

I am training a custom model. After post-training quantization , exporting to int8 model I went on to create a predictor using the exported int8 model.
Apart from dataset changes I haven't made any changes to the code in d2go_beginner.ipynb

from mobile_cv.predictor.api import create_predictor model = create_predictor(predictor_path)
`---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
in ()
1 from mobile_cv.predictor.api import create_predictor
----> 2 model = create_predictor(predictor_path)

3 frames
/usr/local/lib/python3.7/dist-packages/mobile_cv/common/misc/py.py in dynamic_import(obj_full_name)
43 ret = pydoc.locate(obj_full_name)
44 if ret is None:
---> 45 raise ImportError("Cannot dynamically locate {}".format(obj_full_name))
46 return ret
47

ImportError: Cannot dynamically locate d2go.utils.export_utils.D2RCNNTracingWrapper.RunFunc`

How to detect the image by trained model based on DemoPredictor?

Instructions To Reproduce the ๐Ÿ› Bug:

I want to use the trained model to detect and I saw the instruction of jupyter-notebook that it used DemoPredictor to make a predictor.
However, it cannot work (The results were all empty.) if I attempt to individually load the model rather than predict directly after I finished the training.
If I change the DemoPredictor to default predict from Detectron2, then it can work.

Here is my simple main code

import cv2, json
from matplotlib import pyplot as plt
from d2go.utils.demo_predictor import DemoPredictor
from detectron2.utils.visualizer import ColorMode
from detectron2.engine import DefaultPredictor
from d2go.runner import Detectron2GoRunner
from d2go.model_zoo import model_zoo
import os
from detectron2.data import MetadataCatalog, DatasetCatalog
from detectron2.data.datasets import register_coco_instances

register_coco_instances("my_dataset_val", {}, "test.json", "./test_Images/")
my_dataset_val_metadata = MetadataCatalog.get("my_dataset_val")
val_dataset_dicts = DatasetCatalog.get("my_dataset_val")
MetadataCatalog.get("my_dataset_val").set(thing_classes=['top', 'bottom'])

yaml_file = 'mask_rcnn_fbnetv3a_C4.yaml'

runner = Detectron2GoRunner()
cfg = runner.get_default_cfg()
cfg.merge_from_file(model_zoo.get_config_file(yaml_file))
cfg.DATALOADER.NUM_WORKERS = 2
cfg.SOLVER.IMS_PER_BATCH = 2
cfg.MODEL.ROI_HEADS.BATCH_SIZE_PER_IMAGE = 128   # faster, and good enough for this toy dataset
cfg.MODEL.ROI_HEADS.NUM_CLASSES = 4  # only has one class (ballon)
# load weights
cfg.MODEL.WEIGHTS = 'model_final.pth'
cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = 0.7   # set the testing threshold for this model
# Set training data-set path
cfg.DATASETS.TEST = ("my_dataset_val", )

# predictor = DefaultPredictor(cfg)

model = runner.build_model(cfg)
predictor = DemoPredictor(model)

for d in val_dataset_dicts: 
    im = cv2.imread(d["file_name"])
    outputs = predictor(im)
    print(outputs)

If I use this one to make a predictor, then it can load the weight and predict correctly.

predictor = DefaultPredictor(cfg)

However, if I change to this one which was from https://github.com/facebookresearch/d2go/blob/master/demo/d2go_beginner.ipynb

model = runner.build_model(cfg)
predictor = DemoPredictor(model)

Then it seems to fail to load the model that outputs are nothing.

Or should I need to use this way to load the model_final.pth and to do inference?

from mobile_cv.predictor.api import create_predictor
patch_d2_meta_arch()

cfg_name = 'faster_rcnn_fbnetv3a_dsmask_C4.yaml'
pytorch_model = model_zoo.get(cfg_name, trained=True)
pytorch_model.cpu()

with create_fake_detection_data_loader(224, 320, is_train=False) as data_loader:
    predictor_path = convert_and_export_predictor(
            model_zoo.get_config(cfg_name),
            copy.deepcopy(pytorch_model),
            "torchscript_int8@tracing",
            './',
            data_loader,
        )

model = create_predictor(predictor_path)

Expected behavior:

I expect I can load the model_final.pth to output the correct results.

Thank you so much!

Link Missing

Hi,

Thanks for the great work! The link in the below image is missing. Could you please add the link?

image

Export semantic model fails

Hello.

Full reproducible code.

import copy
from detectron2 import model_zoo
from detectron2.config import CfgNode
from detectron2.data import build_detection_test_loader
from d2go.export.api import convert_and_export_predictor
from d2go.utils.testing.data_loader_helper import create_fake_detection_data_loader
from d2go.export.d2_meta_arch import patch_d2_meta_arch
from d2go.runner import create_runner


configs = ["COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_1x.yaml","Misc/semantic_R_50_FPN_1x.yaml"]
use_config = 0

cfg = model_zoo.get_config(configs[use_config])
cfg.set_new_allowed(True)
cfg.RCNN_PREPARE_FOR_EXPORT = "default_rcnn_prepare_for_export"
cfg.QUANTIZATION = CfgNode()
cfg.QUANTIZATION.SILICON_QAT = CfgNode({"ENABLED": True})
cfg.QUANTIZATION.QAT = CfgNode({"ENABLED": True})
cfg.MODEL_EMA = CfgNode({"ENABLED": True})
cfg.MODEL.FROZEN_LAYER_REG_EXP = []
cfg.QUANTIZATION.BACKEND = "qnnpack"

runner = create_runner("d2go.runner.GeneralizedRCNNRunner")
if use_config == 0:
    pytorch_model = model_zoo.get(configs[use_config], trained=True) # The trained=True is just to verify that the model is working
else:
    pytorch_model = model_zoo.get(configs[use_config])
    
pytorch_model.cpu()
pytorch_model.eval()

patch_d2_meta_arch()
with create_fake_detection_data_loader(224, 320, is_train=False) as data_loader:
    predictor_path = convert_and_export_predictor(
            cfg,
            copy.deepcopy(pytorch_model),
            "torchscript@tracing",
           './',
            data_loader,
        )

### Uncomment to test that model works. ###

#from d2go.utils.demo_predictor import DemoPredictor
#import numpy as np
#import matplotlib.pyplot as plt
#from PIL import Image
#from detectron2.utils.visualizer import Visualizer
#from detectron2.data import MetadataCatalog
#from mobile_cv.predictor.api import create_predictor

#im = np.uint8(Image.open("./000000439715.jpg")) # Some image, for instance one from coco.

#for model in [pytorch_model, "./torchscript@tracing"]:
#    if isinstance(model, str): # We load the torchscript model
#        model = create_predictor(model)

#    predictor = DemoPredictor(model)
#    outputs = predictor(im)

#    if cfg.MODEL.META_ARCHITECTURE =="SemanticSegmentor":
        # We expect to get nonsens since the model isnt trained.
        # However the only thing that matters is that the model 
        # and the torchscript model are agreeing
#        result = np.argmax(outputs["sem_seg"].to("cpu").numpy(),axis=0)
#        plt.imshow(result)
#        plt.show()
#    else:
#        v = Visualizer(im[:, :, ::-1], MetadataCatalog.get("coco_2017_train"))
#        out = v.draw_instance_predictions(outputs["instances"].to("cpu"))
#        plt.imshow(out.get_image()[:, :, ::-1])
#        plt.show()

You can uncomment the last part to check that both of the mask_rcnn models works.

Changing use_config = 0 to use_config = 1 does the same thing, but for a semantic model in stead of an instance model.
Doing this causes an AssertitionError:

File "/home/peter/anaconda3/lib/python3.8/site-packages/d2go/export/api.py", line 122, in convert_and_export_predictor
return export_predictor(cfg, pytorch_model, predictor_type, output_dir, data_loader)
File "/home/peter/anaconda3/lib/python3.8/site-packages/d2go/export/api.py", line 151, in export_predictor
return default_export_predictor(
File "/home/peter/anaconda3/lib/python3.8/site-packages/d2go/export/api.py", line 197, in default_export_predictor
assert hasattr(pytorch_model, "prepare_for_export"), pytorch_model
AssertionError: SemanticSegmentor

It would be very nice to be able to use d2go to export semantic models as well.

Latency Benchmark

Hi, thanks for your great work!

I wonder how to measure and benchmark the Model Latency in the model zoo on mobile devices.
Would you provide benchmark tools like TensorFlow Lite Benchmark Tools in the future?

Thanks.

ONNX support

Hi, will like to check if d2go have plans to support ONNX exporting? Understand that detectron2 already supports export to ONNX, but it is limited to caffe2 runtime. Export to ONNX that is compatible with onnxruntime or TensorRT will be great.

masks not detected properly

Hi there,
the results seem weird, even after changing MIN_SIZE_TEST.
is this normal:

Mask-RCNN-FBNetV3A:
2

mask_rcnn_fbnetv3a_dsmask_C4.yaml:
3

mask_rcnn_fbnetv3g_fpn.yaml
output1

ImportError: cannot import name 'final' from 'typing' (/usr/local/lib/python3.7/typing.py)

Hi I was trying to run D2go on google collab . Following were my steps

  • Install Conda in google collab
# Install conda and add channels to look for packages in
import sys
! wget https://repo.anaconda.com/archive/Anaconda3-2020.02-Linux-x86_64.sh
! chmod +x Anaconda3-2020.02-Linux-x86_64.sh
! bash ./Anaconda3-2020.02-Linux-x86_64.sh -b -f -p /usr/local
sys.path.append('/usr/local/lib/python3.7/site-packages/')
! conda update -n base -c defaults conda -y
! conda config --add channels bioconda
! conda config --add channels conda-forge
  • Install the rest of dependencies in step
!conda install pytorch torchvision cudatoolkit=11.0 -c pytorch
!python -m pip install 'git+https://github.com/facebookresearch/detectron2.git'
!python -m pip install 'git+https://github.com/facebookresearch/mobile-vision.git'
!git clone https://github.com/facebookresearch/d2go
%cd d2go 
!python -m pip install .
#install the pyyaml verision
!pip install pyyaml
!wget http://images.cocodataset.org/val2017/000000439715.jpg -q -O input.jpg
#run demo
!python demo.py --config-file faster_rcnn_fbnetv3a_C4.yaml --input /content/d2go/demo/input.jpg --output output1.jpg 

I get the following error
I was wondering what changes are needed to be done ?

Traceback (most recent call last):
  File "demo.py", line 14, in <module>
    from d2go.model_zoo import model_zoo
  File "/usr/local/lib/python3.7/site-packages/d2go/model_zoo/model_zoo.py", line 8, in <module>
    from d2go.runner import create_runner
  File "/usr/local/lib/python3.7/site-packages/d2go/runner/__init__.py", line 10, in <module>
    from .default_runner import BaseRunner, Detectron2GoRunner, GeneralizedRCNNRunner
  File "/usr/local/lib/python3.7/site-packages/d2go/runner/default_runner.py", line 31, in <module>
    from d2go.export.caffe2_model_helper import update_cfg_from_pb_model
  File "/usr/local/lib/python3.7/site-packages/d2go/export/__init__.py", line 5, in <module>
    from . import caffe2  # noqa
  File "/usr/local/lib/python3.7/site-packages/d2go/export/caffe2.py", line 10, in <module>
    from d2go.export.api import ModelExportMethodRegistry, ModelExportMethod
  File "/usr/local/lib/python3.7/site-packages/d2go/export/api.py", line 32, in <module>
    from typing import final
ImportError: cannot import name 'final' from 'typing' (/usr/local/lib/python3.7/typing.py)

AssertionError when trying to export faster_rcnn_fbnetv3g_fpn.yaml

Instructions To Reproduce the ๐Ÿ› Bug:

  1. Full runnable code or full changes you made:
import copy
from detectron2.data import build_detection_test_loader
from d2go.export.api import convert_and_export_predictor
from d2go.utils.testing.data_loader_helper import create_fake_detection_data_loader
from d2go.export.d2_meta_arch import patch_d2_meta_arch
from d2go.model_zoo import model_zoo

import logging

# disable all the warnings
previous_level = logging.root.manager.disable
logging.disable(logging.INFO)

patch_d2_meta_arch()

cfg_name = 'faster_rcnn_fbnetv3g_fpn.yaml'
pytorch_model = model_zoo.get(cfg_name, trained=True)
pytorch_model.cpu()

with create_fake_detection_data_loader(224, 320, is_train=False) as data_loader:
    predictor_path = convert_and_export_predictor(
            model_zoo.get_config(cfg_name),
            copy.deepcopy(pytorch_model),
            "torchscript_int8@tracing",
            './',
            data_loader,
        )

# recover the logging level
logging.disable(previous_level)
  1. What exact command you run: python export_test.py
  2. Full logs or other relevant observations:
Arguments ['width_divisor', 'dw_skip_bnrelu', 'zero_last_bn_gamma'] skipped for op Conv2d
loading annotations into memory...
Done (t=0.00s)
creating index...
index created!
/home/florian/anaconda3/envs/d2go1.8.1/lib/python3.8/site-packages/torch/quantization/observer.py:121: UserWarning: Please use quant_min and quant_max to specify the range for observers.                     reduce_range will be deprecated in a future release of PyTorch.
  warnings.warn(
Traceback (most recent call last):
  File "d2go/export_test.py", line 21, in <module>
    predictor_path = convert_and_export_predictor(
  File "/home/florian/Documents/Repositories/pytorch_source/d2go/d2go/export/api.py", line 100, in convert_and_export_predictor
    assert not fuse_utils.check_bn_exist(pytorch_model)
AssertionError
  1. please simplify the steps as much as possible so they do not require additional resources to run, such as a private dataset.

Expected behavior:

I used the sample code from the d2go_beginner notebook and changed faster_rcnn_fbnetv3a_dsmask_C4.yaml to faster_rcnn_fbnetv3g_fpn.yaml, but this seems to break the export functionality and I receive the AssertionError.

ModuleNotFoundError: No module named 'd2go.data.fb'

I've just rebuilt d2go again in a Docker Container:

When I try to import d2go I get the following error:

>>> import d2go
X11 connection rejected because of wrong authentication.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/appuser/.local/lib/python3.8/site-packages/d2go/__init__.py", line 7, in <module>
    from d2go import initializer, optimizer  # NOQA
  File "/home/appuser/.local/lib/python3.8/site-packages/d2go/initializer.py", line 66, in <module>
    initialize_all()
  File "/home/appuser/.local/lib/python3.8/site-packages/d2go/initializer.py", line 61, in initialize_all
    _register()
  File "/home/appuser/.local/lib/python3.8/site-packages/d2go/initializer.py", line 17, in timed_f
    ret = f(*args, **kwargs)
  File "/home/appuser/.local/lib/python3.8/site-packages/d2go/initializer.py", line 46, in _register
    from d2go.data import dataset_mappers # NOQA
  File "/home/appuser/.local/lib/python3.8/site-packages/d2go/data/__init__.py", line 5, in <module>
    import d2go.data.datasets
  File "/home/appuser/.local/lib/python3.8/site-packages/d2go/data/datasets.py", line 10, in <module>
    from d2go.data.fb.adhoc_hive_dataset import COCOHiveLoaderConfig
ModuleNotFoundError: No module named 'd2go.data.fb'

need android demo


๐Ÿš€ Feature

A clear and concise description of the feature proposal.

Motivation & Examples

Tell us why the feature is useful.

Describe what the feature would look like, if it is implemented.
Best demonstrated using code examples in addition to words.

RuntimeError: Could not run 'aten::thnn_conv2d_forward' with arguments from the 'QuantizedCPU' backend.

I encountered a runtime error RuntimeError: Could not run 'aten::thnn_conv2d_forward' with arguments from the 'QuantizedCPU' backend. when I tried exporting a COCO object detection model. The error can be reproduced with the code shown below.

The configuration file and datasets I used are customized, the full configuration can be found under the full log and datasets can be replaced by anything else. You can still reproduce this issue by just exporting the model output from model_zoo.get_checkpoint_url("faster_rcnn_fbnetv3g_fpn.yaml") without any further training.

Note that this error only occurred when exporting Faster-RCNN-FBNetV3G-FPN model but Faster-RCNN-FBNetV3A and Faster-RCNN-FBNetV3A-dsmask can be exported smoothly.

There is a PyTorch document where common errors in quantization process are discussed. The document suggests this error is caused by passing a quantized Tensor into a non-quantized kernel and dequantization is the solution.

class M(torch.nn.Module):
    def __init__(self):
        super().__init__()
        self.quant = torch.quantization.QuantStub()
        self.conv1 = torch.nn.Conv2d(1, 1, 1)
        # this module will not be quantized (see `qconfig = None` logic below)
        self.conv2 = torch.nn.Conv2d(1, 1, 1)
        self.dequant = torch.quantization.DeQuantStub()

    def forward(self, x):
        # during the convert step, this will be replaced with a
        # `quantize_per_tensor` call
        x = self.quant(x)
        x = self.conv1(x)
        # during the convert step, this will be replaced with a
        # `dequantize` call
        x = self.dequant(x)
        x = self.conv2(x)
        return x

In my case, the class is Conv2d.
This error however occurred after post-training quantization(ptq) which is triggered in convert_and_export_predictor function so I'm not sure is dequantizing Tensor after ptq making any sense. I tried adding self.dequant = torch.quantization.DeQuantStub() and x = self.dequant(x) into Conv2d anyway but the result remained unchanged.

Any help would be appreciated.

Instructions To Reproduce the ๐Ÿ› Bug:

import detectron2, os, copy
import mobile_cv.lut.lib.pt.flops_utils as flops_utils
from detectron2.utils.logger import setup_logger
from detectron2.data.datasets import register_coco_instances
from d2go.model_zoo import model_zoo
from d2go.runner import GeneralizedRCNNRunner
from d2go.config import temp_defrost
from d2go.export.api import convert_and_export_predictor
from d2go.export.d2_meta_arch import patch_d2_meta_arch
from d2go.setup import (
    basic_argument_parser,
    prepare_for_launch,
    setup_after_launch,
)


def prepare_for_launch():
    runner = GeneralizedRCNNRunner()
    cfg = runner.get_default_cfg()
    cfg.merge_from_file("/content/drive/MyDrive/Detectron2 Data/faster_rcnn_fbnetv3g_fpn_customized.ymal")
    cfg.MODEL_EMA.ENABLED = False
    cfg.DATASETS.TRAIN = ("sports_ball_train",)
    cfg.DATASETS.TEST = ("sports_ball_val",)
    cfg.DATALOADER.NUM_WORKERS = 2
    cfg.MODEL.WEIGHTS = model_zoo.get_checkpoint_url("faster_rcnn_fbnetv3g_fpn.yaml")
    cfg.SOLVER.IMS_PER_BATCH = 2
    cfg.SOLVER.BASE_LR = 0.00025
    cfg.SOLVER.MAX_ITER = 600
    cfg.SOLVER.STEPS = []  
    cfg.MODEL.ROI_HEADS.BATCH_SIZE_PER_IMAGE = 128
    
    cfg.MODEL.ROI_HEADS.NUM_CLASSES = 1 

    os.makedirs(cfg.OUTPUT_DIR, exist_ok=True)

    return cfg, runner


def export_predictor_int8(cfg, output_dir, runner):
  patch_d2_meta_arch()

  cfg = copy.deepcopy(cfg)
  setup_after_launch(cfg, output_dir, runner)
  with temp_defrost(cfg):
    cfg.merge_from_list(["MODEL.DEVICE", "cpu"])
  model = runner.build_model(cfg, eval_only=True)

  datasets = list(cfg.DATASETS.TRAIN)
  data_loader = runner.build_detection_test_loader(cfg, datasets)

  first_batch = next(iter(data_loader))
  input_args = (first_batch,)
  #flops_utils.print_model_flops(model, input_args)

  pytorch_model = copy.deepcopy(model)
  predictor_path = convert_and_export_predictor(
    cfg, pytorch_model, "torchscript_mobile_int8@tracing", output_dir, data_loader
  )
  return predictor_path


cfg, runner = prepare_for_launch()
model = runner.build_model(cfg)
final_cfg = runner.do_train(cfg, model, resume=False)["model_final"]
predictor_path = export_predictor_int8(final_cfg, "/content/drive/MyDrive/Detectron2 Data/d2go_fpn_600/output", runner)

The code was run on Colab and the CUDA version was changed to 10.1 by running commands shown below.

%cd /usr/local/
!pwd
!ls
!rm -rf cuda
!ln -s /usr/local/cuda-10.1 /usr/local/cuda

Full logs:

WARNING [06/17 17:25:01 d2go.setup]: Override cfg.OUTPUT_DIR (./output) to be the same as output_dir /content/drive/MyDrive/Detectron2 Data/d2go_fpn_600/output
[06/17 17:25:02 d2go.setup]: Full config saved to /content/drive/MyDrive/Detectron2 Data/d2go_fpn_600/output/config.yaml
[06/17 17:25:02 d2go.setup]: Initializing runner ...
[06/17 17:25:02 d2go.setup]: Using 1 processes per machine. Rank of current process: 0
[06/17 17:25:03 d2go.setup]: Environment info:
----------------------  ---------------------------------------------------------------
sys.platform            linux
Python                  3.7.10 (default, May  3 2021, 02:48:31) [GCC 7.5.0]
numpy                   1.19.5
detectron2              0.4.1 @/usr/local/lib/python3.7/dist-packages/detectron2
Compiler                GCC 7.5
CUDA compiler           CUDA 10.1
detectron2 arch flags   6.0
DETECTRON2_ENV_MODULE   <not set>
PyTorch                 1.8.1+cu101 @/usr/local/lib/python3.7/dist-packages/torch
PyTorch debug build     False
GPU available           True
GPU 0                   Tesla P100-PCIE-16GB (arch=6.0)
CUDA_HOME               /usr/local/cuda
Pillow                  7.1.2
torchvision             0.9.1+cu101 @/usr/local/lib/python3.7/dist-packages/torchvision
torchvision arch flags  3.5, 5.0, 6.0, 7.0, 7.5
fvcore                  0.1.5.post20210617
iopath                  0.1.8
cv2                     4.1.2
----------------------  ---------------------------------------------------------------
PyTorch built with:
  - GCC 7.3
  - C++ Version: 201402
  - Intel(R) Math Kernel Library Version 2020.0.0 Product Build 20191122 for Intel(R) 64 architecture applications
  - Intel(R) MKL-DNN v1.7.0 (Git Hash 7aed236906b1f7a05c0917e5257a1af05e9ff683)
  - OpenMP 201511 (a.k.a. OpenMP 4.5)
  - NNPACK is enabled
  - CPU capability usage: AVX2
  - CUDA Runtime 10.1
  - NVCC architecture flags: -gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_70,code=sm_70
  - CuDNN 7.6.3
  - Magma 2.5.2
  - Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=10.1, CUDNN_VERSION=7.6.3, CXX_COMPILER=/opt/rh/devtoolset-7/root/usr/bin/c++, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_KINETO -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=1.8.1, USE_CUDA=ON, USE_CUDNN=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON, 

[06/17 17:25:03 d2go.setup]: Running with full config:
ABNORMAL_CHECKER:
  ENABLED: False
CUDNN_BENCHMARK: False
D2GO_DATA:
  AUG_OPS:
    TEST: ['ResizeShortestEdgeOp']
    TRAIN: ['ResizeShortestEdgeOp', 'RandomFlipOp']
  DATASETS:
    COCO_INJECTION:
      IM_DIRS: []
      JSON_FILES: []
      KEYPOINT_METADATA: []
      NAMES: []
    DYNAMIC_DATASETS: []
    TEST_CATEGORIES: ()
    TRAIN_CATEGORIES: ()
  MAPPER:
    BACKFILL_SIZE: False
    CATCH_EXCEPTION: True
    NAME: D2GoDatasetMapper
    RETRY: 3
  TEST:
    MAX_IMAGES: 0
    SUBSET_SAMPLING: frontmost
DATALOADER:
  ASPECT_RATIO_GROUPING: True
  FILTER_EMPTY_ANNOTATIONS: True
  NUM_WORKERS: 2
  REPEAT_THRESHOLD: 0.0
  SAMPLER_TRAIN: TrainingSampler
DATASETS:
  PRECOMPUTED_PROPOSAL_TOPK_TEST: 1000
  PRECOMPUTED_PROPOSAL_TOPK_TRAIN: 2000
  PROPOSAL_FILES_TEST: ()
  PROPOSAL_FILES_TRAIN: ()
  TEST: ('sports_ball_val',)
  TRAIN: ('sports_ball_train',)
  TRAIN_REPEAT_FACTOR: []
EXPORT_CAFFE2:
  USE_HEATMAP_MAX_KEYPOINT: False
GLOBAL:
  HACK: 1.0
INPUT:
  CROP:
    ENABLED: False
    SIZE: [0.9, 0.9]
    TYPE: relative_range
  FORMAT: BGR
  MASK_FORMAT: polygon
  MAX_SIZE_TEST: 1333
  MAX_SIZE_TRAIN: 1333
  MIN_SIZE_TEST: 800
  MIN_SIZE_TRAIN: (640, 672, 704, 736, 768, 800)
  MIN_SIZE_TRAIN_SAMPLING: choice
  RANDOM_FLIP: horizontal
MODEL:
  ANCHOR_GENERATOR:
    ANGLES: [[-90, 0, 90]]
    ASPECT_RATIOS: [[0.5, 1.0, 2.0]]
    NAME: DefaultAnchorGenerator
    OFFSET: 0.0
    SIZES: [[32], [64], [128], [256], [512]]
  BACKBONE:
    FREEZE_AT: 0
    NAME: FBNetV2FpnBackbone
  DDP_FIND_UNUSED_PARAMETERS: False
  DDP_FP16_GRAD_COMPRESS: False
  DEVICE: cuda
  FBNET_V2:
    ARCH: FBNetV3_G_fpn
    ARCH_DEF: []
    NORM: None
    NORM_ARGS: []
    SCALE_FACTOR: 1.0
    STEM_IN_CHANNELS: 3
    WIDTH_DIVISOR: 8
  FPN:
    FUSE_TYPE: sum
    IN_FEATURES: ['trunk1', 'trunk2', 'trunk3', 'trunk4']
    NORM: 
    OUT_CHANNELS: 128
  FROZEN_LAYER_REG_EXP: []
  KEYPOINT_ON: False
  KMEANS_ANCHORS:
    DATASETS: ()
    KMEANS_ANCHORS_ON: False
    NUM_CLUSTERS: 0
    NUM_TRAINING_IMG: 0
    RNG_SEED: 3
  LOAD_PROPOSALS: False
  MASK_ON: False
  META_ARCHITECTURE: GeneralizedRCNN
  PANOPTIC_FPN:
    COMBINE:
      ENABLED: True
      INSTANCES_CONFIDENCE_THRESH: 0.5
      OVERLAP_THRESH: 0.5
      STUFF_AREA_LIMIT: 4096
    INSTANCE_LOSS_WEIGHT: 1.0
  PIXEL_MEAN: [103.53, 116.28, 123.675]
  PIXEL_STD: [1.0, 1.0, 1.0]
  PROPOSAL_GENERATOR:
    MIN_SIZE: 0
    NAME: RPN
  RESNETS:
    DEFORM_MODULATED: False
    DEFORM_NUM_GROUPS: 1
    DEFORM_ON_PER_STAGE: [False, False, False, False]
    DEPTH: 50
    NORM: FrozenBN
    NUM_GROUPS: 1
    OUT_FEATURES: ['res2', 'res3', 'res4', 'res5']
    RES2_OUT_CHANNELS: 256
    RES5_DILATION: 1
    STEM_OUT_CHANNELS: 64
    STRIDE_IN_1X1: True
    WIDTH_PER_GROUP: 64
  RETINANET:
    BBOX_REG_LOSS_TYPE: smooth_l1
    BBOX_REG_WEIGHTS: (1.0, 1.0, 1.0, 1.0)
    FOCAL_LOSS_ALPHA: 0.25
    FOCAL_LOSS_GAMMA: 2.0
    IN_FEATURES: ['p3', 'p4', 'p5', 'p6', 'p7']
    IOU_LABELS: [0, -1, 1]
    IOU_THRESHOLDS: [0.4, 0.5]
    NMS_THRESH_TEST: 0.5
    NORM: 
    NUM_CLASSES: 80
    NUM_CONVS: 4
    PRIOR_PROB: 0.01
    SCORE_THRESH_TEST: 0.05
    SMOOTH_L1_LOSS_BETA: 0.1
    TOPK_CANDIDATES_TEST: 1000
  ROI_BOX_CASCADE_HEAD:
    BBOX_REG_WEIGHTS: ((10.0, 10.0, 5.0, 5.0), (20.0, 20.0, 10.0, 10.0), (30.0, 30.0, 15.0, 15.0))
    IOUS: (0.5, 0.6, 0.7)
  ROI_BOX_HEAD:
    BBOX_REG_LOSS_TYPE: smooth_l1
    BBOX_REG_LOSS_WEIGHT: 1.0
    BBOX_REG_WEIGHTS: (10.0, 10.0, 5.0, 5.0)
    CLS_AGNOSTIC_BBOX_REG: False
    CONV_DIM: 256
    FC_DIM: 1024
    NAME: FBNetV2RoIBoxHead
    NORM: None
    NUM_CONV: 0
    NUM_FC: 0
    POOLER_RESOLUTION: 6
    POOLER_SAMPLING_RATIO: 0
    POOLER_TYPE: ROIAlignV2
    SMOOTH_L1_BETA: 0.0
    TRAIN_ON_PRED_BOXES: False
  ROI_HEADS:
    BATCH_SIZE_PER_IMAGE: 128
    IN_FEATURES: ['p3', 'p4', 'p5', 'p6']
    IOU_LABELS: [0, 1]
    IOU_THRESHOLDS: [0.5]
    NAME: StandardROIHeads
    NMS_THRESH_TEST: 0.5
    NUM_CLASSES: 1
    POSITIVE_FRACTION: 0.25
    PROPOSAL_APPEND_GT: True
    SCORE_THRESH_TEST: 0.05
  ROI_KEYPOINT_HEAD:
    CONV_DIMS: (512, 512, 512, 512, 512, 512, 512, 512)
    LOSS_WEIGHT: 1.0
    MIN_KEYPOINTS_PER_IMAGE: 1
    NAME: KRCNNConvDeconvUpsampleHead
    NORMALIZE_LOSS_BY_VISIBLE_KEYPOINTS: True
    NUM_KEYPOINTS: 17
    POOLER_RESOLUTION: 14
    POOLER_SAMPLING_RATIO: 0
    POOLER_TYPE: ROIAlignV2
  ROI_MASK_HEAD:
    CLS_AGNOSTIC_MASK: False
    CONV_DIM: 256
    NAME: MaskRCNNConvUpsampleHead
    NORM: 
    NUM_CONV: 4
    POOLER_RESOLUTION: 14
    POOLER_SAMPLING_RATIO: 0
    POOLER_TYPE: ROIAlignV2
  RPN:
    BATCH_SIZE_PER_IMAGE: 256
    BBOX_REG_LOSS_TYPE: smooth_l1
    BBOX_REG_LOSS_WEIGHT: 1.0
    BBOX_REG_WEIGHTS: (1.0, 1.0, 1.0, 1.0)
    BOUNDARY_THRESH: -1
    CONV_DIMS: [-1]
    HEAD_NAME: FBNetV2RpnHead
    IN_FEATURES: ['p2', 'p3', 'p4', 'p5', 'p6']
    IOU_LABELS: [0, -1, 1]
    IOU_THRESHOLDS: [0.3, 0.7]
    LOSS_WEIGHT: 1.0
    NMS_THRESH: 0.7
    POSITIVE_FRACTION: 0.5
    POST_NMS_TOPK_TEST: 1000
    POST_NMS_TOPK_TRAIN: 2000
    PRE_NMS_TOPK_TEST: 1000
    PRE_NMS_TOPK_TRAIN: 2000
    SMOOTH_L1_BETA: 0.0
  SEM_SEG_HEAD:
    COMMON_STRIDE: 4
    CONVS_DIM: 128
    IGNORE_VALUE: 255
    IN_FEATURES: ['p2', 'p3', 'p4', 'p5']
    LOSS_WEIGHT: 1.0
    NAME: SemSegFPNHead
    NORM: GN
    NUM_CLASSES: 54
  SUBCLASS:
    NUM_LAYERS: 1
    NUM_SUBCLASSES: 0
    SUBCLASS_ID_FETCHER: SubclassFetcher
    SUBCLASS_MAPPING: []
    SUBCLASS_ON: False
  VT_FPN:
    HEADS: 16
    IN_FEATURES: ['res2', 'res3', 'res4', 'res5']
    LAYERS: 3
    MIN_GROUP_PLANES: 64
    NORM: None
    OUT_CHANNELS: 256
    POS_HWS: []
    POS_N_DOWNSAMPLE: []
    TOKEN_C: 1024
    TOKEN_LS: [16, 16, 8, 8]
  WEIGHTS: ./output/model_final.pth
MODEL_EMA:
  DECAY: 0.9998
  DEVICE: 
  ENABLED: False
  USE_EMA_WEIGHTS_FOR_EVAL_ONLY: False
OUTPUT_DIR: /content/drive/MyDrive/Detectron2 Data/d2go_fpn_600/output
QUANTIZATION:
  BACKEND: qnnpack
  CUSTOM_QSCHEME: 
  EAGER_MODE: True
  MODULES: None
  NAME: 
  PTQ:
    CALIBRATION_FORCE_ON_GPU: False
    CALIBRATION_NUM_IMAGES: 1
  QAT:
    BATCH_SIZE_FACTOR: 1.0
    DISABLE_OBSERVER_ITER: 38000
    ENABLED: False
    ENABLE_OBSERVER_ITER: 35000
    FREEZE_BN_ITER: 37000
    START_ITER: 35000
    UPDATE_OBSERVER_STATS_PERIOD: 1
    UPDATE_OBSERVER_STATS_PERIODICALLY: False
RCNN_PREPARE_FOR_EXPORT: default_rcnn_prepare_for_export
RCNN_PREPARE_FOR_QUANT: default_rcnn_prepare_for_quant
RCNN_PREPARE_FOR_QUANT_CONVERT: default_rcnn_prepare_for_quant_convert
SEED: -1
SOLVER:
  AMP:
    ENABLED: False
  AUTO_SCALING_METHODS: ['default_scale_d2_configs', 'default_scale_quantization_configs']
  BASE_LR: 0.00025
  BIAS_LR_FACTOR: 1.0
  CHECKPOINT_PERIOD: 5000
  CLIP_GRADIENTS:
    CLIP_TYPE: value
    CLIP_VALUE: 1.0
    ENABLED: False
    NORM_TYPE: 2.0
  GAMMA: 0.1
  IMS_PER_BATCH: 2
  LR_MULTIPLIER_OVERWRITE: []
  LR_SCHEDULER_NAME: WarmupCosineLR
  MAX_ITER: 60
  MOMENTUM: 0.9
  NESTEROV: False
  OPTIMIZER: sgd
  REFERENCE_WORLD_SIZE: 8
  STEPS: []
  WARMUP_FACTOR: 0.001
  WARMUP_ITERS: 1000
  WARMUP_METHOD: linear
  WEIGHT_DECAY: 0.0001
  WEIGHT_DECAY_BIAS: 0.0001
  WEIGHT_DECAY_NORM: 0.0
TENSORBOARD:
  TEST_VIS_MAX_IMAGES: 16
  TRAIN_LOADER_VIS_MAX_IMAGES: 16
  TRAIN_LOADER_VIS_WRITE_PERIOD: 20
TEST:
  AUG:
    ENABLED: False
    FLIP: True
    MAX_SIZE: 4000
    MIN_SIZES: (400, 500, 600, 700, 800, 900, 1000, 1100, 1200)
  DETECTIONS_PER_IMAGE: 100
  EVAL_PERIOD: 5000
  EXPECTED_RESULTS: []
  KEYPOINT_OKS_SIGMAS: []
  PRECISE_BN:
    ENABLED: False
    NUM_ITER: 200
VERSION: 2
VIS_PERIOD: 0
[06/17 17:25:03 d2go.setup]: Running with runner: <d2go.runner.default_runner.GeneralizedRCNNRunner object at 0x7fce8dd70ed0>
[06/17 17:25:03 d2go.config.config]: Applying auto scaling method: default_scale_d2_configs
[06/17 17:25:03 d2go.config.config]: Applying auto scaling method: default_scale_quantization_configs
[06/17 17:25:03 d2go.config.config]: Auto-scaled the config according to the actual world size: 
| config key                             | old value   | new value   |
|:---------------------------------------|:------------|:------------|
| QUANTIZATION.QAT.DISABLE_OBSERVER_ITER | 38000       | 304000      |
| QUANTIZATION.QAT.ENABLE_OBSERVER_ITER  | 35000       | 280000      |
| QUANTIZATION.QAT.FREEZE_BN_ITER        | 37000       | 296000      |
| QUANTIZATION.QAT.START_ITER            | 35000       | 280000      |
| SOLVER.BASE_LR                         | 0.00025     | 3.125e-05   |
| SOLVER.IMS_PER_BATCH                   | 2           | 0           |
| SOLVER.MAX_ITER                        | 60          | 480         |
| SOLVER.REFERENCE_WORLD_SIZE            | 8           | 1           |
| SOLVER.STEPS                           | []          | ()          |
| SOLVER.WARMUP_ITERS                    | 1000        | 8000        |
| TEST.EVAL_PERIOD                       | 5000        | 40000       |
[06/17 17:25:03 d2go.modeling.backbone.fbnet_v2]: Build FBNet using unified arch_def:
trunk
- {'block_op': 'conv_k3', 'block_cfg': {'out_channels': 32, 'stride': 2}, 'stage_idx': 0, 'block_idx': 0}
- {'block_op': 'ir_k3', 'block_cfg': {'out_channels': 24, 'stride': 1, 'expansion': 1, 'less_se_channels': False}, 'stage_idx': 0, 'block_idx': 1}
- {'block_op': 'ir_k3', 'block_cfg': {'out_channels': 24, 'stride': 1, 'expansion': 1, 'less_se_channels': False}, 'stage_idx': 0, 'block_idx': 2}
- {'block_op': 'ir_k3', 'block_cfg': {'out_channels': 24, 'stride': 1, 'expansion': 1, 'less_se_channels': False}, 'stage_idx': 0, 'block_idx': 3}
- {'block_op': 'ir_k5', 'block_cfg': {'out_channels': 40, 'stride': 2, 'expansion': 4, 'less_se_channels': False}, 'stage_idx': 1, 'block_idx': 0}
- {'block_op': 'ir_k5', 'block_cfg': {'out_channels': 40, 'stride': 1, 'expansion': 2, 'less_se_channels': False}, 'stage_idx': 1, 'block_idx': 1}
- {'block_op': 'ir_k5', 'block_cfg': {'out_channels': 40, 'stride': 1, 'expansion': 2, 'less_se_channels': False}, 'stage_idx': 1, 'block_idx': 2}
- {'block_op': 'ir_k5', 'block_cfg': {'out_channels': 40, 'stride': 1, 'expansion': 2, 'less_se_channels': False}, 'stage_idx': 1, 'block_idx': 3}
- {'block_op': 'ir_k5', 'block_cfg': {'out_channels': 40, 'stride': 1, 'expansion': 2, 'less_se_channels': False}, 'stage_idx': 1, 'block_idx': 4}
- {'block_op': 'ir_k5_se', 'block_cfg': {'out_channels': 56, 'stride': 2, 'expansion': 4, 'less_se_channels': False}, 'stage_idx': 2, 'block_idx': 0}
- {'block_op': 'ir_k5_se', 'block_cfg': {'out_channels': 56, 'stride': 1, 'expansion': 3, 'less_se_channels': False}, 'stage_idx': 2, 'block_idx': 1}
- {'block_op': 'ir_k5_se', 'block_cfg': {'out_channels': 56, 'stride': 1, 'expansion': 3, 'less_se_channels': False}, 'stage_idx': 2, 'block_idx': 2}
- {'block_op': 'ir_k5_se', 'block_cfg': {'out_channels': 56, 'stride': 1, 'expansion': 3, 'less_se_channels': False}, 'stage_idx': 2, 'block_idx': 3}
- {'block_op': 'ir_k5_se', 'block_cfg': {'out_channels': 56, 'stride': 1, 'expansion': 3, 'less_se_channels': False}, 'stage_idx': 2, 'block_idx': 4}
- {'block_op': 'ir_k5', 'block_cfg': {'out_channels': 104, 'stride': 2, 'expansion': 5, 'less_se_channels': False}, 'stage_idx': 3, 'block_idx': 0}
- {'block_op': 'ir_k3', 'block_cfg': {'out_channels': 104, 'stride': 1, 'expansion': 3, 'less_se_channels': False}, 'stage_idx': 3, 'block_idx': 1}
- {'block_op': 'ir_k3', 'block_cfg': {'out_channels': 104, 'stride': 1, 'expansion': 3, 'less_se_channels': False}, 'stage_idx': 3, 'block_idx': 2}
- {'block_op': 'ir_k3', 'block_cfg': {'out_channels': 104, 'stride': 1, 'expansion': 3, 'less_se_channels': False}, 'stage_idx': 3, 'block_idx': 3}
- {'block_op': 'ir_k3', 'block_cfg': {'out_channels': 104, 'stride': 1, 'expansion': 3, 'less_se_channels': False}, 'stage_idx': 3, 'block_idx': 4}
- {'block_op': 'ir_k3_se', 'block_cfg': {'out_channels': 160, 'stride': 1, 'expansion': 5, 'less_se_channels': False}, 'stage_idx': 3, 'block_idx': 5}
- {'block_op': 'ir_k5_se', 'block_cfg': {'out_channels': 160, 'stride': 1, 'expansion': 3, 'less_se_channels': False}, 'stage_idx': 3, 'block_idx': 6}
- {'block_op': 'ir_k5_se', 'block_cfg': {'out_channels': 160, 'stride': 1, 'expansion': 3, 'less_se_channels': False}, 'stage_idx': 3, 'block_idx': 7}
- {'block_op': 'ir_k5_se', 'block_cfg': {'out_channels': 160, 'stride': 1, 'expansion': 3, 'less_se_channels': False}, 'stage_idx': 3, 'block_idx': 8}
- {'block_op': 'ir_k5_se', 'block_cfg': {'out_channels': 160, 'stride': 1, 'expansion': 3, 'less_se_channels': False}, 'stage_idx': 3, 'block_idx': 9}
- {'block_op': 'ir_k5_se', 'block_cfg': {'out_channels': 160, 'stride': 1, 'expansion': 3, 'less_se_channels': False}, 'stage_idx': 3, 'block_idx': 10}
- {'block_op': 'ir_k5_se', 'block_cfg': {'out_channels': 160, 'stride': 1, 'expansion': 3, 'less_se_channels': False}, 'stage_idx': 3, 'block_idx': 11}
- {'block_op': 'ir_k5_se', 'block_cfg': {'out_channels': 160, 'stride': 1, 'expansion': 3, 'less_se_channels': False}, 'stage_idx': 3, 'block_idx': 12}
- {'block_op': 'ir_k5_se', 'block_cfg': {'out_channels': 160, 'stride': 1, 'expansion': 3, 'less_se_channels': False}, 'stage_idx': 3, 'block_idx': 13}
- {'block_op': 'ir_k3_se', 'block_cfg': {'out_channels': 264, 'stride': 2, 'expansion': 6, 'less_se_channels': False}, 'stage_idx': 4, 'block_idx': 0}
- {'block_op': 'ir_k5_se', 'block_cfg': {'out_channels': 264, 'stride': 1, 'expansion': 5, 'less_se_channels': False}, 'stage_idx': 4, 'block_idx': 1}
- {'block_op': 'ir_k5_se', 'block_cfg': {'out_channels': 264, 'stride': 1, 'expansion': 5, 'less_se_channels': False}, 'stage_idx': 4, 'block_idx': 2}
- {'block_op': 'ir_k5_se', 'block_cfg': {'out_channels': 264, 'stride': 1, 'expansion': 5, 'less_se_channels': False}, 'stage_idx': 4, 'block_idx': 3}
- {'block_op': 'ir_k5_se', 'block_cfg': {'out_channels': 264, 'stride': 1, 'expansion': 5, 'less_se_channels': False}, 'stage_idx': 4, 'block_idx': 4}
- {'block_op': 'ir_k5_se', 'block_cfg': {'out_channels': 264, 'stride': 1, 'expansion': 5, 'less_se_channels': False}, 'stage_idx': 4, 'block_idx': 5}
- {'block_op': 'ir_k5_se', 'block_cfg': {'out_channels': 264, 'stride': 1, 'expansion': 5, 'less_se_channels': False}, 'stage_idx': 4, 'block_idx': 6}
- {'block_op': 'ir_k5_se', 'block_cfg': {'out_channels': 288, 'stride': 1, 'expansion': 6, 'less_se_channels': False}, 'stage_idx': 4, 'block_idx': 7}
- {'block_op': 'ir_k5_se', 'block_cfg': {'out_channels': 288, 'stride': 1, 'expansion': 6, 'less_se_channels': False}, 'stage_idx': 4, 'block_idx': 8}
WARNING [06/17 17:25:03 mobile_cv.arch.utils.helper]: Arguments ['width_divisor', 'dw_skip_bnrelu', 'zero_last_bn_gamma'] skipped for op Conv2d
[06/17 17:25:04 d2go.modeling.backbone.fbnet_v2]: Build FBNet using unified arch_def:
rpn
- {'block_op': 'ir_k5_se', 'block_cfg': {'out_channels': 160, 'stride': 1, 'expansion': 3, 'less_se_channels': False}, 'stage_idx': 0, 'block_idx': 0}
[06/17 17:25:04 d2go.modeling.backbone.fbnet_v2]: Build FBNet using unified arch_def:
bbox
- {'block_op': 'ir_k3_se', 'block_cfg': {'out_channels': 264, 'stride': 2, 'expansion': 6, 'less_se_channels': False}, 'stage_idx': 0, 'block_idx': 0}
- {'block_op': 'ir_k5_se', 'block_cfg': {'out_channels': 264, 'stride': 1, 'expansion': 5, 'less_se_channels': False}, 'stage_idx': 0, 'block_idx': 1}
- {'block_op': 'ir_k5_se', 'block_cfg': {'out_channels': 264, 'stride': 1, 'expansion': 5, 'less_se_channels': False}, 'stage_idx': 0, 'block_idx': 2}
- {'block_op': 'ir_k5_se', 'block_cfg': {'out_channels': 264, 'stride': 1, 'expansion': 5, 'less_se_channels': False}, 'stage_idx': 0, 'block_idx': 3}
- {'block_op': 'ir_k5_se', 'block_cfg': {'out_channels': 264, 'stride': 1, 'expansion': 5, 'less_se_channels': False}, 'stage_idx': 0, 'block_idx': 4}
- {'block_op': 'ir_k5_se', 'block_cfg': {'out_channels': 264, 'stride': 1, 'expansion': 5, 'less_se_channels': False}, 'stage_idx': 0, 'block_idx': 5}
- {'block_op': 'ir_k5_se', 'block_cfg': {'out_channels': 264, 'stride': 1, 'expansion': 5, 'less_se_channels': False}, 'stage_idx': 0, 'block_idx': 6}
- {'block_op': 'ir_k5_se', 'block_cfg': {'out_channels': 288, 'stride': 1, 'expansion': 6, 'less_se_channels': False}, 'stage_idx': 0, 'block_idx': 7}
- {'block_op': 'ir_k5_se', 'block_cfg': {'out_channels': 288, 'stride': 1, 'expansion': 6, 'less_se_channels': False}, 'stage_idx': 0, 'block_idx': 8}
[06/17 17:25:04 fvcore.common.checkpoint]: [Checkpointer] Loading from ./output/model_final.pth ...
WARNING [06/17 17:25:04 fvcore.common.checkpoint]: Some model parameters or buffers are not found in the checkpoint:
backbone.fpn_lateral2.bias
backbone.fpn_lateral3.bias
backbone.fpn_lateral4.bias
backbone.fpn_lateral5.bias
backbone.fpn_output2.bias
backbone.fpn_output3.bias
backbone.fpn_output4.bias
backbone.fpn_output5.bias
WARNING [06/17 17:25:04 fvcore.common.checkpoint]: The checkpoint state_dict contains keys that are not used by the model:
  backbone.fpn_lateral2.norm.{bias, num_batches_tracked, running_mean, running_var, weight}
  backbone.fpn_output2.norm.{bias, num_batches_tracked, running_mean, running_var, weight}
  backbone.fpn_lateral3.norm.{bias, num_batches_tracked, running_mean, running_var, weight}
  backbone.fpn_output3.norm.{bias, num_batches_tracked, running_mean, running_var, weight}
  backbone.fpn_lateral4.norm.{bias, num_batches_tracked, running_mean, running_var, weight}
  backbone.fpn_output4.norm.{bias, num_batches_tracked, running_mean, running_var, weight}
  backbone.fpn_lateral5.norm.{bias, num_batches_tracked, running_mean, running_var, weight}
  backbone.fpn_output5.norm.{bias, num_batches_tracked, running_mean, running_var, weight}
[06/17 17:25:04 d2go.runner.default_runner]: Building detection test loader for dataset: ['sports_ball_train'] ...
[06/17 17:25:04 d2go.runner.default_runner]: Using dataset mapper:
D2GoDatasetMapper:
  is_train: False
  image_loader: None
  tfm_gens: 
    - ResizeShortestEdge(short_edge_length=(800, 800), max_size=1333, sample_style='choice')
WARNING [06/17 17:25:04 d2.data.datasets.coco]: 
Category ids in annotations are not in [1, #categories]! We'll apply a mapping for you.

WARNING [06/17 17:25:04 d2.data.datasets.coco]: 
Category ids in annotations are not in [1, #categories]! We'll apply a mapping for you.

[06/17 17:25:04 d2.data.datasets.coco]: Loaded 4262 images in COCO format from /content/drive/MyDrive/Detectron2 Data/sports_ball/train/via_region_data.json
[06/17 17:25:04 d2.data.datasets.coco]: Loaded 4262 images in COCO format from /content/drive/MyDrive/Detectron2 Data/sports_ball/train/via_region_data.json
[06/17 17:25:05 d2.data.common]: Serializing 4262 elements to byte tensors and concatenating them all ...
[06/17 17:25:05 d2.data.common]: Serializing 4262 elements to byte tensors and concatenating them all ...
[06/17 17:25:05 d2.data.common]: Serialized dataset takes 3.10 MiB
[06/17 17:25:05 d2.data.common]: Serialized dataset takes 3.10 MiB
[06/17 17:25:06 d2go.export.api]: The model is not quantized during training, running post training quantization ...
[06/17 17:25:06 d2go.modeling.meta_arch.rcnn]: Setup the model with qconfig:
QConfig(activation=functools.partial(<class 'torch.quantization.observer.HistogramObserver'>, reduce_range=False), weight=functools.partial(<class 'torch.quantization.observer.MinMaxObserver'>, dtype=torch.qint8, qscheme=torch.per_tensor_symmetric))
[06/17 17:25:06 d2go.modeling.quantization]: Prepared the PTQ model for calibration:
GeneralizedRCNN(
  (backbone): QuantWrapSubClass(
    (fpn_lateral2): Conv2d(40, 128, kernel_size=(1, 1), stride=(1, 1))
    (fpn_output2): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
    (fpn_lateral3): Conv2d(56, 128, kernel_size=(1, 1), stride=(1, 1))
    (fpn_output3): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
    (fpn_lateral4): Conv2d(160, 128, kernel_size=(1, 1), stride=(1, 1))
    (fpn_output4): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
    (fpn_lateral5): Conv2d(288, 128, kernel_size=(1, 1), stride=(1, 1))
    (fpn_output5): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
    (top_block): LastLevelMaxPool()
    (bottom_up): FBNetV2Backbone(
      (trunk0): Sequential(
        (fbnetv2_0_0): ConvBNRelu(
          (conv): ConvReLU2d(
            (0): Conv2d(3, 32, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))
            (1): ReLU(inplace=True)
            (activation_post_process): HistogramObserver()
          )
          (relu): Identity()
        )
        (fbnetv2_0_1): IRFBlock(
          (dw): ConvBNRelu(
            (conv): Conv2d(
              32, 32, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=32, bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (pwl): ConvBNRelu(
            (conv): Conv2d(
              32, 24, kernel_size=(1, 1), stride=(1, 1), bias=False
              (activation_post_process): HistogramObserver()
            )
          )
        )
        (fbnetv2_0_2): IRFBlock(
          (dw): ConvBNRelu(
            (conv): Conv2d(
              24, 24, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=24, bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (pwl): ConvBNRelu(
            (conv): Conv2d(
              24, 24, kernel_size=(1, 1), stride=(1, 1), bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (res_conn): TorchAdd(
            (add_func): FloatFunctional(
              (activation_post_process): HistogramObserver()
            )
          )
        )
        (fbnetv2_0_3): IRFBlock(
          (dw): ConvBNRelu(
            (conv): Conv2d(
              24, 24, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=24, bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (pwl): ConvBNRelu(
            (conv): Conv2d(
              24, 24, kernel_size=(1, 1), stride=(1, 1), bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (res_conn): TorchAdd(
            (add_func): FloatFunctional(
              (activation_post_process): HistogramObserver()
            )
          )
        )
      )
      (trunk1): Sequential(
        (fbnetv2_1_0): IRFBlock(
          (pw): ConvBNRelu(
            (conv): ConvReLU2d(
              (0): Conv2d(24, 96, kernel_size=(1, 1), stride=(1, 1), bias=False)
              (1): ReLU(inplace=True)
              (activation_post_process): HistogramObserver()
            )
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): Conv2d(
              96, 96, kernel_size=(5, 5), stride=(2, 2), padding=(2, 2), groups=96, bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (pwl): ConvBNRelu(
            (conv): Conv2d(
              96, 40, kernel_size=(1, 1), stride=(1, 1), bias=False
              (activation_post_process): HistogramObserver()
            )
          )
        )
        (fbnetv2_1_1): IRFBlock(
          (pw): ConvBNRelu(
            (conv): ConvReLU2d(
              (0): Conv2d(40, 80, kernel_size=(1, 1), stride=(1, 1), bias=False)
              (1): ReLU(inplace=True)
              (activation_post_process): HistogramObserver()
            )
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): Conv2d(
              80, 80, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), groups=80, bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (pwl): ConvBNRelu(
            (conv): Conv2d(
              80, 40, kernel_size=(1, 1), stride=(1, 1), bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (res_conn): TorchAdd(
            (add_func): FloatFunctional(
              (activation_post_process): HistogramObserver()
            )
          )
        )
        (fbnetv2_1_2): IRFBlock(
          (pw): ConvBNRelu(
            (conv): ConvReLU2d(
              (0): Conv2d(40, 80, kernel_size=(1, 1), stride=(1, 1), bias=False)
              (1): ReLU(inplace=True)
              (activation_post_process): HistogramObserver()
            )
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): Conv2d(
              80, 80, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), groups=80, bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (pwl): ConvBNRelu(
            (conv): Conv2d(
              80, 40, kernel_size=(1, 1), stride=(1, 1), bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (res_conn): TorchAdd(
            (add_func): FloatFunctional(
              (activation_post_process): HistogramObserver()
            )
          )
        )
        (fbnetv2_1_3): IRFBlock(
          (pw): ConvBNRelu(
            (conv): ConvReLU2d(
              (0): Conv2d(40, 80, kernel_size=(1, 1), stride=(1, 1), bias=False)
              (1): ReLU(inplace=True)
              (activation_post_process): HistogramObserver()
            )
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): Conv2d(
              80, 80, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), groups=80, bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (pwl): ConvBNRelu(
            (conv): Conv2d(
              80, 40, kernel_size=(1, 1), stride=(1, 1), bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (res_conn): TorchAdd(
            (add_func): FloatFunctional(
              (activation_post_process): HistogramObserver()
            )
          )
        )
        (fbnetv2_1_4): IRFBlock(
          (pw): ConvBNRelu(
            (conv): ConvReLU2d(
              (0): Conv2d(40, 80, kernel_size=(1, 1), stride=(1, 1), bias=False)
              (1): ReLU(inplace=True)
              (activation_post_process): HistogramObserver()
            )
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): Conv2d(
              80, 80, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), groups=80, bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (pwl): ConvBNRelu(
            (conv): Conv2d(
              80, 40, kernel_size=(1, 1), stride=(1, 1), bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (res_conn): TorchAdd(
            (add_func): FloatFunctional(
              (activation_post_process): HistogramObserver()
            )
          )
        )
      )
      (trunk2): Sequential(
        (fbnetv2_2_0): IRFBlock(
          (pw): ConvBNRelu(
            (conv): ConvReLU2d(
              (0): Conv2d(40, 160, kernel_size=(1, 1), stride=(1, 1), bias=False)
              (1): ReLU(inplace=True)
              (activation_post_process): HistogramObserver()
            )
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): Conv2d(
              160, 160, kernel_size=(5, 5), stride=(2, 2), padding=(2, 2), groups=160, bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): ConvReLU2d(
                  (0): Conv2d(160, 40, kernel_size=(1, 1), stride=(1, 1))
                  (1): ReLU(inplace=True)
                  (activation_post_process): HistogramObserver()
                )
                (relu): Identity()
              )
              (1): Conv2d(
                40, 160, kernel_size=(1, 1), stride=(1, 1)
                (activation_post_process): HistogramObserver()
              )
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): FloatFunctional(
                (activation_post_process): HistogramObserver()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): Conv2d(
              160, 56, kernel_size=(1, 1), stride=(1, 1), bias=False
              (activation_post_process): HistogramObserver()
            )
          )
        )
        (fbnetv2_2_1): IRFBlock(
          (pw): ConvBNRelu(
            (conv): ConvReLU2d(
              (0): Conv2d(56, 168, kernel_size=(1, 1), stride=(1, 1), bias=False)
              (1): ReLU(inplace=True)
              (activation_post_process): HistogramObserver()
            )
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): Conv2d(
              168, 168, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), groups=168, bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): ConvReLU2d(
                  (0): Conv2d(168, 40, kernel_size=(1, 1), stride=(1, 1))
                  (1): ReLU(inplace=True)
                  (activation_post_process): HistogramObserver()
                )
                (relu): Identity()
              )
              (1): Conv2d(
                40, 168, kernel_size=(1, 1), stride=(1, 1)
                (activation_post_process): HistogramObserver()
              )
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): FloatFunctional(
                (activation_post_process): HistogramObserver()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): Conv2d(
              168, 56, kernel_size=(1, 1), stride=(1, 1), bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (res_conn): TorchAdd(
            (add_func): FloatFunctional(
              (activation_post_process): HistogramObserver()
            )
          )
        )
        (fbnetv2_2_2): IRFBlock(
          (pw): ConvBNRelu(
            (conv): ConvReLU2d(
              (0): Conv2d(56, 168, kernel_size=(1, 1), stride=(1, 1), bias=False)
              (1): ReLU(inplace=True)
              (activation_post_process): HistogramObserver()
            )
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): Conv2d(
              168, 168, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), groups=168, bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): ConvReLU2d(
                  (0): Conv2d(168, 40, kernel_size=(1, 1), stride=(1, 1))
                  (1): ReLU(inplace=True)
                  (activation_post_process): HistogramObserver()
                )
                (relu): Identity()
              )
              (1): Conv2d(
                40, 168, kernel_size=(1, 1), stride=(1, 1)
                (activation_post_process): HistogramObserver()
              )
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): FloatFunctional(
                (activation_post_process): HistogramObserver()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): Conv2d(
              168, 56, kernel_size=(1, 1), stride=(1, 1), bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (res_conn): TorchAdd(
            (add_func): FloatFunctional(
              (activation_post_process): HistogramObserver()
            )
          )
        )
        (fbnetv2_2_3): IRFBlock(
          (pw): ConvBNRelu(
            (conv): ConvReLU2d(
              (0): Conv2d(56, 168, kernel_size=(1, 1), stride=(1, 1), bias=False)
              (1): ReLU(inplace=True)
              (activation_post_process): HistogramObserver()
            )
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): Conv2d(
              168, 168, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), groups=168, bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): ConvReLU2d(
                  (0): Conv2d(168, 40, kernel_size=(1, 1), stride=(1, 1))
                  (1): ReLU(inplace=True)
                  (activation_post_process): HistogramObserver()
                )
                (relu): Identity()
              )
              (1): Conv2d(
                40, 168, kernel_size=(1, 1), stride=(1, 1)
                (activation_post_process): HistogramObserver()
              )
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): FloatFunctional(
                (activation_post_process): HistogramObserver()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): Conv2d(
              168, 56, kernel_size=(1, 1), stride=(1, 1), bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (res_conn): TorchAdd(
            (add_func): FloatFunctional(
              (activation_post_process): HistogramObserver()
            )
          )
        )
        (fbnetv2_2_4): IRFBlock(
          (pw): ConvBNRelu(
            (conv): ConvReLU2d(
              (0): Conv2d(56, 168, kernel_size=(1, 1), stride=(1, 1), bias=False)
              (1): ReLU(inplace=True)
              (activation_post_process): HistogramObserver()
            )
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): Conv2d(
              168, 168, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), groups=168, bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): ConvReLU2d(
                  (0): Conv2d(168, 40, kernel_size=(1, 1), stride=(1, 1))
                  (1): ReLU(inplace=True)
                  (activation_post_process): HistogramObserver()
                )
                (relu): Identity()
              )
              (1): Conv2d(
                40, 168, kernel_size=(1, 1), stride=(1, 1)
                (activation_post_process): HistogramObserver()
              )
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): FloatFunctional(
                (activation_post_process): HistogramObserver()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): Conv2d(
              168, 56, kernel_size=(1, 1), stride=(1, 1), bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (res_conn): TorchAdd(
            (add_func): FloatFunctional(
              (activation_post_process): HistogramObserver()
            )
          )
        )
      )
      (trunk3): Sequential(
        (fbnetv2_3_0): IRFBlock(
          (pw): ConvBNRelu(
            (conv): ConvReLU2d(
              (0): Conv2d(56, 280, kernel_size=(1, 1), stride=(1, 1), bias=False)
              (1): ReLU(inplace=True)
              (activation_post_process): HistogramObserver()
            )
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): Conv2d(
              280, 280, kernel_size=(5, 5), stride=(2, 2), padding=(2, 2), groups=280, bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (pwl): ConvBNRelu(
            (conv): Conv2d(
              280, 104, kernel_size=(1, 1), stride=(1, 1), bias=False
              (activation_post_process): HistogramObserver()
            )
          )
        )
        (fbnetv2_3_1): IRFBlock(
          (pw): ConvBNRelu(
            (conv): ConvReLU2d(
              (0): Conv2d(104, 312, kernel_size=(1, 1), stride=(1, 1), bias=False)
              (1): ReLU(inplace=True)
              (activation_post_process): HistogramObserver()
            )
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): Conv2d(
              312, 312, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=312, bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (pwl): ConvBNRelu(
            (conv): Conv2d(
              312, 104, kernel_size=(1, 1), stride=(1, 1), bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (res_conn): TorchAdd(
            (add_func): FloatFunctional(
              (activation_post_process): HistogramObserver()
            )
          )
        )
        (fbnetv2_3_2): IRFBlock(
          (pw): ConvBNRelu(
            (conv): ConvReLU2d(
              (0): Conv2d(104, 312, kernel_size=(1, 1), stride=(1, 1), bias=False)
              (1): ReLU(inplace=True)
              (activation_post_process): HistogramObserver()
            )
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): Conv2d(
              312, 312, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=312, bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (pwl): ConvBNRelu(
            (conv): Conv2d(
              312, 104, kernel_size=(1, 1), stride=(1, 1), bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (res_conn): TorchAdd(
            (add_func): FloatFunctional(
              (activation_post_process): HistogramObserver()
            )
          )
        )
        (fbnetv2_3_3): IRFBlock(
          (pw): ConvBNRelu(
            (conv): ConvReLU2d(
              (0): Conv2d(104, 312, kernel_size=(1, 1), stride=(1, 1), bias=False)
              (1): ReLU(inplace=True)
              (activation_post_process): HistogramObserver()
            )
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): Conv2d(
              312, 312, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=312, bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (pwl): ConvBNRelu(
            (conv): Conv2d(
              312, 104, kernel_size=(1, 1), stride=(1, 1), bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (res_conn): TorchAdd(
            (add_func): FloatFunctional(
              (activation_post_process): HistogramObserver()
            )
          )
        )
        (fbnetv2_3_4): IRFBlock(
          (pw): ConvBNRelu(
            (conv): ConvReLU2d(
              (0): Conv2d(104, 312, kernel_size=(1, 1), stride=(1, 1), bias=False)
              (1): ReLU(inplace=True)
              (activation_post_process): HistogramObserver()
            )
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): Conv2d(
              312, 312, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=312, bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (pwl): ConvBNRelu(
            (conv): Conv2d(
              312, 104, kernel_size=(1, 1), stride=(1, 1), bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (res_conn): TorchAdd(
            (add_func): FloatFunctional(
              (activation_post_process): HistogramObserver()
            )
          )
        )
        (fbnetv2_3_5): IRFBlock(
          (pw): ConvBNRelu(
            (conv): ConvReLU2d(
              (0): Conv2d(104, 520, kernel_size=(1, 1), stride=(1, 1), bias=False)
              (1): ReLU(inplace=True)
              (activation_post_process): HistogramObserver()
            )
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): Conv2d(
              520, 520, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=520, bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): ConvReLU2d(
                  (0): Conv2d(520, 128, kernel_size=(1, 1), stride=(1, 1))
                  (1): ReLU(inplace=True)
                  (activation_post_process): HistogramObserver()
                )
                (relu): Identity()
              )
              (1): Conv2d(
                128, 520, kernel_size=(1, 1), stride=(1, 1)
                (activation_post_process): HistogramObserver()
              )
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): FloatFunctional(
                (activation_post_process): HistogramObserver()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): Conv2d(
              520, 160, kernel_size=(1, 1), stride=(1, 1), bias=False
              (activation_post_process): HistogramObserver()
            )
          )
        )
        (fbnetv2_3_6): IRFBlock(
          (pw): ConvBNRelu(
            (conv): ConvReLU2d(
              (0): Conv2d(160, 480, kernel_size=(1, 1), stride=(1, 1), bias=False)
              (1): ReLU(inplace=True)
              (activation_post_process): HistogramObserver()
            )
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): Conv2d(
              480, 480, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), groups=480, bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): ConvReLU2d(
                  (0): Conv2d(480, 120, kernel_size=(1, 1), stride=(1, 1))
                  (1): ReLU(inplace=True)
                  (activation_post_process): HistogramObserver()
                )
                (relu): Identity()
              )
              (1): Conv2d(
                120, 480, kernel_size=(1, 1), stride=(1, 1)
                (activation_post_process): HistogramObserver()
              )
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): FloatFunctional(
                (activation_post_process): HistogramObserver()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): Conv2d(
              480, 160, kernel_size=(1, 1), stride=(1, 1), bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (res_conn): TorchAdd(
            (add_func): FloatFunctional(
              (activation_post_process): HistogramObserver()
            )
          )
        )
        (fbnetv2_3_7): IRFBlock(
          (pw): ConvBNRelu(
            (conv): ConvReLU2d(
              (0): Conv2d(160, 480, kernel_size=(1, 1), stride=(1, 1), bias=False)
              (1): ReLU(inplace=True)
              (activation_post_process): HistogramObserver()
            )
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): Conv2d(
              480, 480, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), groups=480, bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): ConvReLU2d(
                  (0): Conv2d(480, 120, kernel_size=(1, 1), stride=(1, 1))
                  (1): ReLU(inplace=True)
                  (activation_post_process): HistogramObserver()
                )
                (relu): Identity()
              )
              (1): Conv2d(
                120, 480, kernel_size=(1, 1), stride=(1, 1)
                (activation_post_process): HistogramObserver()
              )
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): FloatFunctional(
                (activation_post_process): HistogramObserver()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): Conv2d(
              480, 160, kernel_size=(1, 1), stride=(1, 1), bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (res_conn): TorchAdd(
            (add_func): FloatFunctional(
              (activation_post_process): HistogramObserver()
            )
          )
        )
        (fbnetv2_3_8): IRFBlock(
          (pw): ConvBNRelu(
            (conv): ConvReLU2d(
              (0): Conv2d(160, 480, kernel_size=(1, 1), stride=(1, 1), bias=False)
              (1): ReLU(inplace=True)
              (activation_post_process): HistogramObserver()
            )
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): Conv2d(
              480, 480, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), groups=480, bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): ConvReLU2d(
                  (0): Conv2d(480, 120, kernel_size=(1, 1), stride=(1, 1))
                  (1): ReLU(inplace=True)
                  (activation_post_process): HistogramObserver()
                )
                (relu): Identity()
              )
              (1): Conv2d(
                120, 480, kernel_size=(1, 1), stride=(1, 1)
                (activation_post_process): HistogramObserver()
              )
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): FloatFunctional(
                (activation_post_process): HistogramObserver()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): Conv2d(
              480, 160, kernel_size=(1, 1), stride=(1, 1), bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (res_conn): TorchAdd(
            (add_func): FloatFunctional(
              (activation_post_process): HistogramObserver()
            )
          )
        )
        (fbnetv2_3_9): IRFBlock(
          (pw): ConvBNRelu(
            (conv): ConvReLU2d(
              (0): Conv2d(160, 480, kernel_size=(1, 1), stride=(1, 1), bias=False)
              (1): ReLU(inplace=True)
              (activation_post_process): HistogramObserver()
            )
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): Conv2d(
              480, 480, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), groups=480, bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): ConvReLU2d(
                  (0): Conv2d(480, 120, kernel_size=(1, 1), stride=(1, 1))
                  (1): ReLU(inplace=True)
                  (activation_post_process): HistogramObserver()
                )
                (relu): Identity()
              )
              (1): Conv2d(
                120, 480, kernel_size=(1, 1), stride=(1, 1)
                (activation_post_process): HistogramObserver()
              )
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): FloatFunctional(
                (activation_post_process): HistogramObserver()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): Conv2d(
              480, 160, kernel_size=(1, 1), stride=(1, 1), bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (res_conn): TorchAdd(
            (add_func): FloatFunctional(
              (activation_post_process): HistogramObserver()
            )
          )
        )
        (fbnetv2_3_10): IRFBlock(
          (pw): ConvBNRelu(
            (conv): ConvReLU2d(
              (0): Conv2d(160, 480, kernel_size=(1, 1), stride=(1, 1), bias=False)
              (1): ReLU(inplace=True)
              (activation_post_process): HistogramObserver()
            )
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): Conv2d(
              480, 480, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), groups=480, bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): ConvReLU2d(
                  (0): Conv2d(480, 120, kernel_size=(1, 1), stride=(1, 1))
                  (1): ReLU(inplace=True)
                  (activation_post_process): HistogramObserver()
                )
                (relu): Identity()
              )
              (1): Conv2d(
                120, 480, kernel_size=(1, 1), stride=(1, 1)
                (activation_post_process): HistogramObserver()
              )
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): FloatFunctional(
                (activation_post_process): HistogramObserver()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): Conv2d(
              480, 160, kernel_size=(1, 1), stride=(1, 1), bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (res_conn): TorchAdd(
            (add_func): FloatFunctional(
              (activation_post_process): HistogramObserver()
            )
          )
        )
        (fbnetv2_3_11): IRFBlock(
          (pw): ConvBNRelu(
            (conv): ConvReLU2d(
              (0): Conv2d(160, 480, kernel_size=(1, 1), stride=(1, 1), bias=False)
              (1): ReLU(inplace=True)
              (activation_post_process): HistogramObserver()
            )
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): Conv2d(
              480, 480, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), groups=480, bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): ConvReLU2d(
                  (0): Conv2d(480, 120, kernel_size=(1, 1), stride=(1, 1))
                  (1): ReLU(inplace=True)
                  (activation_post_process): HistogramObserver()
                )
                (relu): Identity()
              )
              (1): Conv2d(
                120, 480, kernel_size=(1, 1), stride=(1, 1)
                (activation_post_process): HistogramObserver()
              )
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): FloatFunctional(
                (activation_post_process): HistogramObserver()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): Conv2d(
              480, 160, kernel_size=(1, 1), stride=(1, 1), bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (res_conn): TorchAdd(
            (add_func): FloatFunctional(
              (activation_post_process): HistogramObserver()
            )
          )
        )
        (fbnetv2_3_12): IRFBlock(
          (pw): ConvBNRelu(
            (conv): ConvReLU2d(
              (0): Conv2d(160, 480, kernel_size=(1, 1), stride=(1, 1), bias=False)
              (1): ReLU(inplace=True)
              (activation_post_process): HistogramObserver()
            )
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): Conv2d(
              480, 480, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), groups=480, bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): ConvReLU2d(
                  (0): Conv2d(480, 120, kernel_size=(1, 1), stride=(1, 1))
                  (1): ReLU(inplace=True)
                  (activation_post_process): HistogramObserver()
                )
                (relu): Identity()
              )
              (1): Conv2d(
                120, 480, kernel_size=(1, 1), stride=(1, 1)
                (activation_post_process): HistogramObserver()
              )
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): FloatFunctional(
                (activation_post_process): HistogramObserver()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): Conv2d(
              480, 160, kernel_size=(1, 1), stride=(1, 1), bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (res_conn): TorchAdd(
            (add_func): FloatFunctional(
              (activation_post_process): HistogramObserver()
            )
          )
        )
        (fbnetv2_3_13): IRFBlock(
          (pw): ConvBNRelu(
            (conv): ConvReLU2d(
              (0): Conv2d(160, 480, kernel_size=(1, 1), stride=(1, 1), bias=False)
              (1): ReLU(inplace=True)
              (activation_post_process): HistogramObserver()
            )
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): Conv2d(
              480, 480, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), groups=480, bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): ConvReLU2d(
                  (0): Conv2d(480, 120, kernel_size=(1, 1), stride=(1, 1))
                  (1): ReLU(inplace=True)
                  (activation_post_process): HistogramObserver()
                )
                (relu): Identity()
              )
              (1): Conv2d(
                120, 480, kernel_size=(1, 1), stride=(1, 1)
                (activation_post_process): HistogramObserver()
              )
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): FloatFunctional(
                (activation_post_process): HistogramObserver()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): Conv2d(
              480, 160, kernel_size=(1, 1), stride=(1, 1), bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (res_conn): TorchAdd(
            (add_func): FloatFunctional(
              (activation_post_process): HistogramObserver()
            )
          )
        )
      )
      (trunk4): Sequential(
        (fbnetv2_4_0): IRFBlock(
          (pw): ConvBNRelu(
            (conv): ConvReLU2d(
              (0): Conv2d(160, 960, kernel_size=(1, 1), stride=(1, 1), bias=False)
              (1): ReLU(inplace=True)
              (activation_post_process): HistogramObserver()
            )
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): Conv2d(
              960, 960, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), groups=960, bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): ConvReLU2d(
                  (0): Conv2d(960, 240, kernel_size=(1, 1), stride=(1, 1))
                  (1): ReLU(inplace=True)
                  (activation_post_process): HistogramObserver()
                )
                (relu): Identity()
              )
              (1): Conv2d(
                240, 960, kernel_size=(1, 1), stride=(1, 1)
                (activation_post_process): HistogramObserver()
              )
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): FloatFunctional(
                (activation_post_process): HistogramObserver()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): Conv2d(
              960, 264, kernel_size=(1, 1), stride=(1, 1), bias=False
              (activation_post_process): HistogramObserver()
            )
          )
        )
        (fbnetv2_4_1): IRFBlock(
          (pw): ConvBNRelu(
            (conv): ConvReLU2d(
              (0): Conv2d(264, 1320, kernel_size=(1, 1), stride=(1, 1), bias=False)
              (1): ReLU(inplace=True)
              (activation_post_process): HistogramObserver()
            )
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): Conv2d(
              1320, 1320, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), groups=1320, bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): ConvReLU2d(
                  (0): Conv2d(1320, 328, kernel_size=(1, 1), stride=(1, 1))
                  (1): ReLU(inplace=True)
                  (activation_post_process): HistogramObserver()
                )
                (relu): Identity()
              )
              (1): Conv2d(
                328, 1320, kernel_size=(1, 1), stride=(1, 1)
                (activation_post_process): HistogramObserver()
              )
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): FloatFunctional(
                (activation_post_process): HistogramObserver()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): Conv2d(
              1320, 264, kernel_size=(1, 1), stride=(1, 1), bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (res_conn): TorchAdd(
            (add_func): FloatFunctional(
              (activation_post_process): HistogramObserver()
            )
          )
        )
        (fbnetv2_4_2): IRFBlock(
          (pw): ConvBNRelu(
            (conv): ConvReLU2d(
              (0): Conv2d(264, 1320, kernel_size=(1, 1), stride=(1, 1), bias=False)
              (1): ReLU(inplace=True)
              (activation_post_process): HistogramObserver()
            )
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): Conv2d(
              1320, 1320, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), groups=1320, bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): ConvReLU2d(
                  (0): Conv2d(1320, 328, kernel_size=(1, 1), stride=(1, 1))
                  (1): ReLU(inplace=True)
                  (activation_post_process): HistogramObserver()
                )
                (relu): Identity()
              )
              (1): Conv2d(
                328, 1320, kernel_size=(1, 1), stride=(1, 1)
                (activation_post_process): HistogramObserver()
              )
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): FloatFunctional(
                (activation_post_process): HistogramObserver()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): Conv2d(
              1320, 264, kernel_size=(1, 1), stride=(1, 1), bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (res_conn): TorchAdd(
            (add_func): FloatFunctional(
              (activation_post_process): HistogramObserver()
            )
          )
        )
        (fbnetv2_4_3): IRFBlock(
          (pw): ConvBNRelu(
            (conv): ConvReLU2d(
              (0): Conv2d(264, 1320, kernel_size=(1, 1), stride=(1, 1), bias=False)
              (1): ReLU(inplace=True)
              (activation_post_process): HistogramObserver()
            )
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): Conv2d(
              1320, 1320, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), groups=1320, bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): ConvReLU2d(
                  (0): Conv2d(1320, 328, kernel_size=(1, 1), stride=(1, 1))
                  (1): ReLU(inplace=True)
                  (activation_post_process): HistogramObserver()
                )
                (relu): Identity()
              )
              (1): Conv2d(
                328, 1320, kernel_size=(1, 1), stride=(1, 1)
                (activation_post_process): HistogramObserver()
              )
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): FloatFunctional(
                (activation_post_process): HistogramObserver()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): Conv2d(
              1320, 264, kernel_size=(1, 1), stride=(1, 1), bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (res_conn): TorchAdd(
            (add_func): FloatFunctional(
              (activation_post_process): HistogramObserver()
            )
          )
        )
        (fbnetv2_4_4): IRFBlock(
          (pw): ConvBNRelu(
            (conv): ConvReLU2d(
              (0): Conv2d(264, 1320, kernel_size=(1, 1), stride=(1, 1), bias=False)
              (1): ReLU(inplace=True)
              (activation_post_process): HistogramObserver()
            )
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): Conv2d(
              1320, 1320, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), groups=1320, bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): ConvReLU2d(
                  (0): Conv2d(1320, 328, kernel_size=(1, 1), stride=(1, 1))
                  (1): ReLU(inplace=True)
                  (activation_post_process): HistogramObserver()
                )
                (relu): Identity()
              )
              (1): Conv2d(
                328, 1320, kernel_size=(1, 1), stride=(1, 1)
                (activation_post_process): HistogramObserver()
              )
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): FloatFunctional(
                (activation_post_process): HistogramObserver()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): Conv2d(
              1320, 264, kernel_size=(1, 1), stride=(1, 1), bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (res_conn): TorchAdd(
            (add_func): FloatFunctional(
              (activation_post_process): HistogramObserver()
            )
          )
        )
        (fbnetv2_4_5): IRFBlock(
          (pw): ConvBNRelu(
            (conv): ConvReLU2d(
              (0): Conv2d(264, 1320, kernel_size=(1, 1), stride=(1, 1), bias=False)
              (1): ReLU(inplace=True)
              (activation_post_process): HistogramObserver()
            )
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): Conv2d(
              1320, 1320, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), groups=1320, bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): ConvReLU2d(
                  (0): Conv2d(1320, 328, kernel_size=(1, 1), stride=(1, 1))
                  (1): ReLU(inplace=True)
                  (activation_post_process): HistogramObserver()
                )
                (relu): Identity()
              )
              (1): Conv2d(
                328, 1320, kernel_size=(1, 1), stride=(1, 1)
                (activation_post_process): HistogramObserver()
              )
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): FloatFunctional(
                (activation_post_process): HistogramObserver()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): Conv2d(
              1320, 264, kernel_size=(1, 1), stride=(1, 1), bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (res_conn): TorchAdd(
            (add_func): FloatFunctional(
              (activation_post_process): HistogramObserver()
            )
          )
        )
        (fbnetv2_4_6): IRFBlock(
          (pw): ConvBNRelu(
            (conv): ConvReLU2d(
              (0): Conv2d(264, 1320, kernel_size=(1, 1), stride=(1, 1), bias=False)
              (1): ReLU(inplace=True)
              (activation_post_process): HistogramObserver()
            )
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): Conv2d(
              1320, 1320, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), groups=1320, bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): ConvReLU2d(
                  (0): Conv2d(1320, 328, kernel_size=(1, 1), stride=(1, 1))
                  (1): ReLU(inplace=True)
                  (activation_post_process): HistogramObserver()
                )
                (relu): Identity()
              )
              (1): Conv2d(
                328, 1320, kernel_size=(1, 1), stride=(1, 1)
                (activation_post_process): HistogramObserver()
              )
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): FloatFunctional(
                (activation_post_process): HistogramObserver()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): Conv2d(
              1320, 264, kernel_size=(1, 1), stride=(1, 1), bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (res_conn): TorchAdd(
            (add_func): FloatFunctional(
              (activation_post_process): HistogramObserver()
            )
          )
        )
        (fbnetv2_4_7): IRFBlock(
          (pw): ConvBNRelu(
            (conv): ConvReLU2d(
              (0): Conv2d(264, 1584, kernel_size=(1, 1), stride=(1, 1), bias=False)
              (1): ReLU(inplace=True)
              (activation_post_process): HistogramObserver()
            )
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): Conv2d(
              1584, 1584, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), groups=1584, bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): ConvReLU2d(
                  (0): Conv2d(1584, 400, kernel_size=(1, 1), stride=(1, 1))
                  (1): ReLU(inplace=True)
                  (activation_post_process): HistogramObserver()
                )
                (relu): Identity()
              )
              (1): Conv2d(
                400, 1584, kernel_size=(1, 1), stride=(1, 1)
                (activation_post_process): HistogramObserver()
              )
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): FloatFunctional(
                (activation_post_process): HistogramObserver()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): Conv2d(
              1584, 288, kernel_size=(1, 1), stride=(1, 1), bias=False
              (activation_post_process): HistogramObserver()
            )
          )
        )
        (fbnetv2_4_8): IRFBlock(
          (pw): ConvBNRelu(
            (conv): ConvReLU2d(
              (0): Conv2d(288, 1728, kernel_size=(1, 1), stride=(1, 1), bias=False)
              (1): ReLU(inplace=True)
              (activation_post_process): HistogramObserver()
            )
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): Conv2d(
              1728, 1728, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), groups=1728, bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): ConvReLU2d(
                  (0): Conv2d(1728, 432, kernel_size=(1, 1), stride=(1, 1))
                  (1): ReLU(inplace=True)
                  (activation_post_process): HistogramObserver()
                )
                (relu): Identity()
              )
              (1): Conv2d(
                432, 1728, kernel_size=(1, 1), stride=(1, 1)
                (activation_post_process): HistogramObserver()
              )
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): FloatFunctional(
                (activation_post_process): HistogramObserver()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): Conv2d(
              1728, 288, kernel_size=(1, 1), stride=(1, 1), bias=False
              (activation_post_process): HistogramObserver()
            )
          )
          (res_conn): TorchAdd(
            (add_func): FloatFunctional(
              (activation_post_process): HistogramObserver()
            )
          )
        )
      )
    )
    (quant_stubs): QuantStubNested(
      (stubs): ModuleList(
        (0): QuantStub(
          (activation_post_process): HistogramObserver()
        )
      )
    )
    (dequant_stubs): QuantStubNested(
      (stubs): ModuleList(
        (0): DeQuantStub()
        (1): DeQuantStub()
        (2): DeQuantStub()
        (3): DeQuantStub()
        (4): DeQuantStub()
      )
    )
  )
  (proposal_generator): RPN(
    (rpn_head): QuantWrapSubClass(
      (rpn_feature): FBNetModule(
        (0): Sequential(
          (fbnetv2_0_0): IRFBlock(
            (pw): ConvBNRelu(
              (conv): ConvReLU2d(
                (0): Conv2d(128, 384, kernel_size=(1, 1), stride=(1, 1), bias=False)
                (1): ReLU(inplace=True)
                (activation_post_process): HistogramObserver()
              )
              (relu): Identity()
            )
            (dw): ConvBNRelu(
              (conv): Conv2d(
                384, 384, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), groups=384, bias=False
                (activation_post_process): HistogramObserver()
              )
            )
            (se): SEModule(
              (avg_pool): AdaptiveAvgPool2d(output_size=1)
              (se): Sequential(
                (0): ConvBNRelu(
                  (conv): ConvReLU2d(
                    (0): Conv2d(384, 96, kernel_size=(1, 1), stride=(1, 1))
                    (1): ReLU(inplace=True)
                    (activation_post_process): HistogramObserver()
                  )
                  (relu): Identity()
                )
                (1): Conv2d(
                  96, 384, kernel_size=(1, 1), stride=(1, 1)
                  (activation_post_process): HistogramObserver()
                )
                (2): Sigmoid()
              )
              (mul): TorchMultiply(
                (mul_func): FloatFunctional(
                  (activation_post_process): HistogramObserver()
                )
              )
            )
            (pwl): ConvBNRelu(
              (conv): Conv2d(
                384, 160, kernel_size=(1, 1), stride=(1, 1), bias=False
                (activation_post_process): HistogramObserver()
              )
            )
          )
        )
      )
      (rpn_regressor): RPNHeadConvRegressor(
        (cls_logits): Conv2d(
          160, 3, kernel_size=(1, 1), stride=(1, 1)
          (activation_post_process): HistogramObserver()
        )
        (bbox_pred): Conv2d(
          160, 12, kernel_size=(1, 1), stride=(1, 1)
          (activation_post_process): HistogramObserver()
        )
      )
      (quant_stubs): QuantStubNested(
        (stubs): ModuleList(
          (0): QuantStub(
            (activation_post_process): HistogramObserver()
          )
          (1): QuantStub(
            (activation_post_process): HistogramObserver()
          )
          (2): QuantStub(
            (activation_post_process): HistogramObserver()
          )
          (3): QuantStub(
            (activation_post_process): HistogramObserver()
          )
          (4): QuantStub(
            (activation_post_process): HistogramObserver()
          )
        )
      )
      (dequant_stubs): QuantStubNested(
        (stubs): ModuleList(
          (0): DeQuantStub()
          (1): DeQuantStub()
          (2): DeQuantStub()
          (3): DeQuantStub()
          (4): DeQuantStub()
          (5): DeQuantStub()
          (6): DeQuantStub()
          (7): DeQuantStub()
          (8): DeQuantStub()
          (9): DeQuantStub()
        )
      )
    )
    (anchor_generator): DefaultAnchorGenerator(
      (cell_anchors): BufferList()
    )
  )
  (roi_heads): StandardROIHeads(
    (box_pooler): ROIPooler(
      (level_poolers): ModuleList(
        (0): ROIAlign(output_size=(6, 6), spatial_scale=0.125, sampling_ratio=0, aligned=True)
        (1): ROIAlign(output_size=(6, 6), spatial_scale=0.0625, sampling_ratio=0, aligned=True)
        (2): ROIAlign(output_size=(6, 6), spatial_scale=0.03125, sampling_ratio=0, aligned=True)
        (3): ROIAlign(output_size=(6, 6), spatial_scale=0.015625, sampling_ratio=0, aligned=True)
      )
    )
    (box_head): QuantWrapSubClass(
      (roi_box_conv): FBNetModule(
        (0): Sequential(
          (fbnetv2_0_0): IRFBlock(
            (pw): ConvBNRelu(
              (conv): ConvReLU2d(
                (0): Conv2d(128, 768, kernel_size=(1, 1), stride=(1, 1), bias=False)
                (1): ReLU(inplace=True)
                (activation_post_process): HistogramObserver()
              )
              (relu): Identity()
            )
            (dw): ConvBNRelu(
              (conv): Conv2d(
                768, 768, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), groups=768, bias=False
                (activation_post_process): HistogramObserver()
              )
            )
            (se): SEModule(
              (avg_pool): AdaptiveAvgPool2d(output_size=1)
              (se): Sequential(
                (0): ConvBNRelu(
                  (conv): ConvReLU2d(
                    (0): Conv2d(768, 192, kernel_size=(1, 1), stride=(1, 1))
                    (1): ReLU(inplace=True)
                    (activation_post_process): HistogramObserver()
                  )
                  (relu): Identity()
                )
                (1): Conv2d(
                  192, 768, kernel_size=(1, 1), stride=(1, 1)
                  (activation_post_process): HistogramObserver()
                )
                (2): Sigmoid()
              )
              (mul): TorchMultiply(
                (mul_func): FloatFunctional(
                  (activation_post_process): HistogramObserver()
                )
              )
            )
            (pwl): ConvBNRelu(
              (conv): Conv2d(
                768, 264, kernel_size=(1, 1), stride=(1, 1), bias=False
                (activation_post_process): HistogramObserver()
              )
            )
          )
          (fbnetv2_0_1): IRFBlock(
            (pw): ConvBNRelu(
              (conv): ConvReLU2d(
                (0): Conv2d(264, 1320, kernel_size=(1, 1), stride=(1, 1), bias=False)
                (1): ReLU(inplace=True)
                (activation_post_process): HistogramObserver()
              )
              (relu): Identity()
            )
            (dw): ConvBNRelu(
              (conv): Conv2d(
                1320, 1320, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), groups=1320, bias=False
                (activation_post_process): HistogramObserver()
              )
            )
            (se): SEModule(
              (avg_pool): AdaptiveAvgPool2d(output_size=1)
              (se): Sequential(
                (0): ConvBNRelu(
                  (conv): ConvReLU2d(
                    (0): Conv2d(1320, 328, kernel_size=(1, 1), stride=(1, 1))
                    (1): ReLU(inplace=True)
                    (activation_post_process): HistogramObserver()
                  )
                  (relu): Identity()
                )
                (1): Conv2d(
                  328, 1320, kernel_size=(1, 1), stride=(1, 1)
                  (activation_post_process): HistogramObserver()
                )
                (2): Sigmoid()
              )
              (mul): TorchMultiply(
                (mul_func): FloatFunctional(
                  (activation_post_process): HistogramObserver()
                )
              )
            )
            (pwl): ConvBNRelu(
              (conv): Conv2d(
                1320, 264, kernel_size=(1, 1), stride=(1, 1), bias=False
                (activation_post_process): HistogramObserver()
              )
            )
            (res_conn): TorchAdd(
              (add_func): FloatFunctional(
                (activation_post_process): HistogramObserver()
              )
            )
          )
          (fbnetv2_0_2): IRFBlock(
            (pw): ConvBNRelu(
              (conv): ConvReLU2d(
                (0): Conv2d(264, 1320, kernel_size=(1, 1), stride=(1, 1), bias=False)
                (1): ReLU(inplace=True)
                (activation_post_process): HistogramObserver()
              )
              (relu): Identity()
            )
            (dw): ConvBNRelu(
              (conv): Conv2d(
                1320, 1320, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), groups=1320, bias=False
                (activation_post_process): HistogramObserver()
              )
            )
            (se): SEModule(
              (avg_pool): AdaptiveAvgPool2d(output_size=1)
              (se): Sequential(
                (0): ConvBNRelu(
                  (conv): ConvReLU2d(
                    (0): Conv2d(1320, 328, kernel_size=(1, 1), stride=(1, 1))
                    (1): ReLU(inplace=True)
                    (activation_post_process): HistogramObserver()
                  )
                  (relu): Identity()
                )
                (1): Conv2d(
                  328, 1320, kernel_size=(1, 1), stride=(1, 1)
                  (activation_post_process): HistogramObserver()
                )
                (2): Sigmoid()
              )
              (mul): TorchMultiply(
                (mul_func): FloatFunctional(
                  (activation_post_process): HistogramObserver()
                )
              )
            )
            (pwl): ConvBNRelu(
              (conv): Conv2d(
                1320, 264, kernel_size=(1, 1), stride=(1, 1), bias=False
                (activation_post_process): HistogramObserver()
              )
            )
            (res_conn): TorchAdd(
              (add_func): FloatFunctional(
                (activation_post_process): HistogramObserver()
              )
            )
          )
          (fbnetv2_0_3): IRFBlock(
            (pw): ConvBNRelu(
              (conv): ConvReLU2d(
                (0): Conv2d(264, 1320, kernel_size=(1, 1), stride=(1, 1), bias=False)
                (1): ReLU(inplace=True)
                (activation_post_process): HistogramObserver()
              )
              (relu): Identity()
            )
            (dw): ConvBNRelu(
              (conv): Conv2d(
                1320, 1320, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), groups=1320, bias=False
                (activation_post_process): HistogramObserver()
              )
            )
            (se): SEModule(
              (avg_pool): AdaptiveAvgPool2d(output_size=1)
              (se): Sequential(
                (0): ConvBNRelu(
                  (conv): ConvReLU2d(
                    (0): Conv2d(1320, 328, kernel_size=(1, 1), stride=(1, 1))
                    (1): ReLU(inplace=True)
                    (activation_post_process): HistogramObserver()
                  )
                  (relu): Identity()
                )
                (1): Conv2d(
                  328, 1320, kernel_size=(1, 1), stride=(1, 1)
                  (activation_post_process): HistogramObserver()
                )
                (2): Sigmoid()
              )
              (mul): TorchMultiply(
                (mul_func): FloatFunctional(
                  (activation_post_process): HistogramObserver()
                )
              )
            )
            (pwl): ConvBNRelu(
              (conv): Conv2d(
                1320, 264, kernel_size=(1, 1), stride=(1, 1), bias=False
                (activation_post_process): HistogramObserver()
              )
            )
            (res_conn): TorchAdd(
              (add_func): FloatFunctional(
                (activation_post_process): HistogramObserver()
              )
            )
          )
          (fbnetv2_0_4): IRFBlock(
            (pw): ConvBNRelu(
              (conv): ConvReLU2d(
                (0): Conv2d(264, 1320, kernel_size=(1, 1), stride=(1, 1), bias=False)
                (1): ReLU(inplace=True)
                (activation_post_process): HistogramObserver()
              )
              (relu): Identity()
            )
            (dw): ConvBNRelu(
              (conv): Conv2d(
                1320, 1320, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), groups=1320, bias=False
                (activation_post_process): HistogramObserver()
              )
            )
            (se): SEModule(
              (avg_pool): AdaptiveAvgPool2d(output_size=1)
              (se): Sequential(
                (0): ConvBNRelu(
                  (conv): ConvReLU2d(
                    (0): Conv2d(1320, 328, kernel_size=(1, 1), stride=(1, 1))
                    (1): ReLU(inplace=True)
                    (activation_post_process): HistogramObserver()
                  )
                  (relu): Identity()
                )
                (1): Conv2d(
                  328, 1320, kernel_size=(1, 1), stride=(1, 1)
                  (activation_post_process): HistogramObserver()
                )
                (2): Sigmoid()
              )
              (mul): TorchMultiply(
                (mul_func): FloatFunctional(
                  (activation_post_process): HistogramObserver()
                )
              )
            )
            (pwl): ConvBNRelu(
              (conv): Conv2d(
                1320, 264, kernel_size=(1, 1), stride=(1, 1), bias=False
                (activation_post_process): HistogramObserver()
              )
            )
            (res_conn): TorchAdd(
              (add_func): FloatFunctional(
                (activation_post_process): HistogramObserver()
              )
            )
          )
          (fbnetv2_0_5): IRFBlock(
            (pw): ConvBNRelu(
              (conv): ConvReLU2d(
                (0): Conv2d(264, 1320, kernel_size=(1, 1), stride=(1, 1), bias=False)
                (1): ReLU(inplace=True)
                (activation_post_process): HistogramObserver()
              )
              (relu): Identity()
            )
            (dw): ConvBNRelu(
              (conv): Conv2d(
                1320, 1320, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), groups=1320, bias=False
                (activation_post_process): HistogramObserver()
              )
            )
            (se): SEModule(
              (avg_pool): AdaptiveAvgPool2d(output_size=1)
              (se): Sequential(
                (0): ConvBNRelu(
                  (conv): ConvReLU2d(
                    (0): Conv2d(1320, 328, kernel_size=(1, 1), stride=(1, 1))
                    (1): ReLU(inplace=True)
                    (activation_post_process): HistogramObserver()
                  )
                  (relu): Identity()
                )
                (1): Conv2d(
                  328, 1320, kernel_size=(1, 1), stride=(1, 1)
                  (activation_post_process): HistogramObserver()
                )
                (2): Sigmoid()
              )
              (mul): TorchMultiply(
                (mul_func): FloatFunctional(
                  (activation_post_process): HistogramObserver()
                )
              )
            )
            (pwl): ConvBNRelu(
              (conv): Conv2d(
                1320, 264, kernel_size=(1, 1), stride=(1, 1), bias=False
                (activation_post_process): HistogramObserver()
              )
            )
            (res_conn): TorchAdd(
              (add_func): FloatFunctional(
                (activation_post_process): HistogramObserver()
              )
            )
          )
          (fbnetv2_0_6): IRFBlock(
            (pw): ConvBNRelu(
              (conv): ConvReLU2d(
                (0): Conv2d(264, 1320, kernel_size=(1, 1), stride=(1, 1), bias=False)
                (1): ReLU(inplace=True)
                (activation_post_process): HistogramObserver()
              )
              (relu): Identity()
            )
            (dw): ConvBNRelu(
              (conv): Conv2d(
                1320, 1320, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), groups=1320, bias=False
                (activation_post_process): HistogramObserver()
              )
            )
            (se): SEModule(
              (avg_pool): AdaptiveAvgPool2d(output_size=1)
              (se): Sequential(
                (0): ConvBNRelu(
                  (conv): ConvReLU2d(
                    (0): Conv2d(1320, 328, kernel_size=(1, 1), stride=(1, 1))
                    (1): ReLU(inplace=True)
                    (activation_post_process): HistogramObserver()
                  )
                  (relu): Identity()
                )
                (1): Conv2d(
                  328, 1320, kernel_size=(1, 1), stride=(1, 1)
                  (activation_post_process): HistogramObserver()
                )
                (2): Sigmoid()
              )
              (mul): TorchMultiply(
                (mul_func): FloatFunctional(
                  (activation_post_process): HistogramObserver()
                )
              )
            )
            (pwl): ConvBNRelu(
              (conv): Conv2d(
                1320, 264, kernel_size=(1, 1), stride=(1, 1), bias=False
                (activation_post_process): HistogramObserver()
              )
            )
            (res_conn): TorchAdd(
              (add_func): FloatFunctional(
                (activation_post_process): HistogramObserver()
              )
            )
          )
          (fbnetv2_0_7): IRFBlock(
            (pw): ConvBNRelu(
              (conv): ConvReLU2d(
                (0): Conv2d(264, 1584, kernel_size=(1, 1), stride=(1, 1), bias=False)
                (1): ReLU(inplace=True)
                (activation_post_process): HistogramObserver()
              )
              (relu): Identity()
            )
            (dw): ConvBNRelu(
              (conv): Conv2d(
                1584, 1584, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), groups=1584, bias=False
                (activation_post_process): HistogramObserver()
              )
            )
            (se): SEModule(
              (avg_pool): AdaptiveAvgPool2d(output_size=1)
              (se): Sequential(
                (0): ConvBNRelu(
                  (conv): ConvReLU2d(
                    (0): Conv2d(1584, 400, kernel_size=(1, 1), stride=(1, 1))
                    (1): ReLU(inplace=True)
                    (activation_post_process): HistogramObserver()
                  )
                  (relu): Identity()
                )
                (1): Conv2d(
                  400, 1584, kernel_size=(1, 1), stride=(1, 1)
                  (activation_post_process): HistogramObserver()
                )
                (2): Sigmoid()
              )
              (mul): TorchMultiply(
                (mul_func): FloatFunctional(
                  (activation_post_process): HistogramObserver()
                )
              )
            )
            (pwl): ConvBNRelu(
              (conv): Conv2d(
                1584, 288, kernel_size=(1, 1), stride=(1, 1), bias=False
                (activation_post_process): HistogramObserver()
              )
            )
          )
          (fbnetv2_0_8): IRFBlock(
            (pw): ConvBNRelu(
              (conv): ConvReLU2d(
                (0): Conv2d(288, 1728, kernel_size=(1, 1), stride=(1, 1), bias=False)
                (1): ReLU(inplace=True)
                (activation_post_process): HistogramObserver()
              )
              (relu): Identity()
            )
            (dw): ConvBNRelu(
              (conv): Conv2d(
                1728, 1728, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), groups=1728, bias=False
                (activation_post_process): HistogramObserver()
              )
            )
            (se): SEModule(
              (avg_pool): AdaptiveAvgPool2d(output_size=1)
              (se): Sequential(
                (0): ConvBNRelu(
                  (conv): ConvReLU2d(
                    (0): Conv2d(1728, 432, kernel_size=(1, 1), stride=(1, 1))
                    (1): ReLU(inplace=True)
                    (activation_post_process): HistogramObserver()
                  )
                  (relu): Identity()
                )
                (1): Conv2d(
                  432, 1728, kernel_size=(1, 1), stride=(1, 1)
                  (activation_post_process): HistogramObserver()
                )
                (2): Sigmoid()
              )
              (mul): TorchMultiply(
                (mul_func): FloatFunctional(
                  (activation_post_process): HistogramObserver()
                )
              )
            )
            (pwl): ConvBNRelu(
              (conv): Conv2d(
                1728, 288, kernel_size=(1, 1), stride=(1, 1), bias=False
                (activation_post_process): HistogramObserver()
              )
            )
            (res_conn): TorchAdd(
              (add_func): FloatFunctional(
                (activation_post_process): HistogramObserver()
              )
            )
          )
        )
      )
      (avgpool): AdaptiveAvgPool2d(output_size=1)
      (quant_stubs): QuantStubNested(
        (stubs): ModuleList(
          (0): QuantStub(
            (activation_post_process): HistogramObserver()
          )
        )
      )
      (dequant_stubs): QuantStubNested(
        (stubs): ModuleList(
          (0): DeQuantStub()
        )
      )
    )
    (box_predictor): QuantWrapSubClass(
      (cls_score): Linear(
        in_features=288, out_features=2, bias=True
        (activation_post_process): HistogramObserver()
      )
      (bbox_pred): Linear(
        in_features=288, out_features=4, bias=True
        (activation_post_process): HistogramObserver()
      )
      (quant_stubs): QuantStubNested(
        (stubs): ModuleList(
          (0): QuantStub(
            (activation_post_process): HistogramObserver()
          )
        )
      )
      (dequant_stubs): QuantStubNested(
        (stubs): ModuleList(
          (0): DeQuantStub()
          (1): DeQuantStub()
        )
      )
    )
  )
)
[06/17 17:25:06 d2go.modeling.quantization]: Running calibration iter: 0/1
[06/17 17:25:19 d2go.export.api]: Converting quantized model qnnpack...
[06/17 17:25:53 d2go.export.api]: Quantized Model:
GeneralizedRCNN(
  (backbone): QuantWrapSubClass(
    (fpn_lateral2): Conv2d(40, 128, kernel_size=(1, 1), stride=(1, 1))
    (fpn_output2): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
    (fpn_lateral3): Conv2d(56, 128, kernel_size=(1, 1), stride=(1, 1))
    (fpn_output3): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
    (fpn_lateral4): Conv2d(160, 128, kernel_size=(1, 1), stride=(1, 1))
    (fpn_output4): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
    (fpn_lateral5): Conv2d(288, 128, kernel_size=(1, 1), stride=(1, 1))
    (fpn_output5): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
    (top_block): LastLevelMaxPool()
    (bottom_up): FBNetV2Backbone(
      (trunk0): Sequential(
        (fbnetv2_0_0): ConvBNRelu(
          (conv): QuantizedConvReLU2d(3, 32, kernel_size=(3, 3), stride=(2, 2), scale=0.8501338362693787, zero_point=0, padding=(1, 1))
          (relu): Identity()
        )
        (fbnetv2_0_1): IRFBlock(
          (dw): ConvBNRelu(
            (conv): QuantizedConv2d(32, 32, kernel_size=(3, 3), stride=(1, 1), scale=0.7093896269798279, zero_point=91, padding=(1, 1), groups=32)
          )
          (pwl): ConvBNRelu(
            (conv): QuantizedConv2d(32, 24, kernel_size=(1, 1), stride=(1, 1), scale=0.32593902945518494, zero_point=137)
          )
        )
        (fbnetv2_0_2): IRFBlock(
          (dw): ConvBNRelu(
            (conv): QuantizedConv2d(24, 24, kernel_size=(3, 3), stride=(1, 1), scale=0.18133769929409027, zero_point=129, padding=(1, 1), groups=24)
          )
          (pwl): ConvBNRelu(
            (conv): QuantizedConv2d(24, 24, kernel_size=(1, 1), stride=(1, 1), scale=0.0969708040356636, zero_point=113)
          )
          (res_conn): TorchAdd(
            (add_func): QFunctional(
              scale=0.3330376148223877, zero_point=143
              (activation_post_process): Identity()
            )
          )
        )
        (fbnetv2_0_3): IRFBlock(
          (dw): ConvBNRelu(
            (conv): QuantizedConv2d(24, 24, kernel_size=(3, 3), stride=(1, 1), scale=0.1158691793680191, zero_point=133, padding=(1, 1), groups=24)
          )
          (pwl): ConvBNRelu(
            (conv): QuantizedConv2d(24, 24, kernel_size=(1, 1), stride=(1, 1), scale=0.04201054573059082, zero_point=144)
          )
          (res_conn): TorchAdd(
            (add_func): QFunctional(
              scale=0.34605783224105835, zero_point=146
              (activation_post_process): Identity()
            )
          )
        )
      )
      (trunk1): Sequential(
        (fbnetv2_1_0): IRFBlock(
          (pw): ConvBNRelu(
            (conv): QuantizedConvReLU2d(24, 96, kernel_size=(1, 1), stride=(1, 1), scale=0.08736933022737503, zero_point=0)
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): QuantizedConv2d(96, 96, kernel_size=(5, 5), stride=(2, 2), scale=0.1593250036239624, zero_point=113, padding=(2, 2), groups=96)
          )
          (pwl): ConvBNRelu(
            (conv): QuantizedConv2d(96, 40, kernel_size=(1, 1), stride=(1, 1), scale=0.06548008322715759, zero_point=131)
          )
        )
        (fbnetv2_1_1): IRFBlock(
          (pw): ConvBNRelu(
            (conv): QuantizedConvReLU2d(40, 80, kernel_size=(1, 1), stride=(1, 1), scale=0.013339834287762642, zero_point=0)
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): QuantizedConv2d(80, 80, kernel_size=(5, 5), stride=(1, 1), scale=0.016740281134843826, zero_point=110, padding=(2, 2), groups=80)
          )
          (pwl): ConvBNRelu(
            (conv): QuantizedConv2d(80, 40, kernel_size=(1, 1), stride=(1, 1), scale=0.0031500624027103186, zero_point=123)
          )
          (res_conn): TorchAdd(
            (add_func): QFunctional(
              scale=0.06176501512527466, zero_point=134
              (activation_post_process): Identity()
            )
          )
        )
        (fbnetv2_1_2): IRFBlock(
          (pw): ConvBNRelu(
            (conv): QuantizedConvReLU2d(40, 80, kernel_size=(1, 1), stride=(1, 1), scale=0.015005774796009064, zero_point=0)
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): QuantizedConv2d(80, 80, kernel_size=(5, 5), stride=(1, 1), scale=0.01408039778470993, zero_point=93, padding=(2, 2), groups=80)
          )
          (pwl): ConvBNRelu(
            (conv): QuantizedConv2d(80, 40, kernel_size=(1, 1), stride=(1, 1), scale=0.0045830262824893, zero_point=73)
          )
          (res_conn): TorchAdd(
            (add_func): QFunctional(
              scale=0.06056637316942215, zero_point=128
              (activation_post_process): Identity()
            )
          )
        )
        (fbnetv2_1_3): IRFBlock(
          (pw): ConvBNRelu(
            (conv): QuantizedConvReLU2d(40, 80, kernel_size=(1, 1), stride=(1, 1), scale=0.011726685799658298, zero_point=0)
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): QuantizedConv2d(80, 80, kernel_size=(5, 5), stride=(1, 1), scale=0.009524916298687458, zero_point=101, padding=(2, 2), groups=80)
          )
          (pwl): ConvBNRelu(
            (conv): QuantizedConv2d(80, 40, kernel_size=(1, 1), stride=(1, 1), scale=0.0017330370610579848, zero_point=95)
          )
          (res_conn): TorchAdd(
            (add_func): QFunctional(
              scale=0.06146929785609245, zero_point=129
              (activation_post_process): Identity()
            )
          )
        )
        (fbnetv2_1_4): IRFBlock(
          (pw): ConvBNRelu(
            (conv): QuantizedConvReLU2d(40, 80, kernel_size=(1, 1), stride=(1, 1), scale=0.007583246566355228, zero_point=0)
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): QuantizedConv2d(80, 80, kernel_size=(5, 5), stride=(1, 1), scale=0.0035592708736658096, zero_point=135, padding=(2, 2), groups=80)
          )
          (pwl): ConvBNRelu(
            (conv): QuantizedConv2d(80, 40, kernel_size=(1, 1), stride=(1, 1), scale=0.0006742602563463151, zero_point=119)
          )
          (res_conn): TorchAdd(
            (add_func): QFunctional(
              scale=0.060878101736307144, zero_point=128
              (activation_post_process): Identity()
            )
          )
        )
      )
      (trunk2): Sequential(
        (fbnetv2_2_0): IRFBlock(
          (pw): ConvBNRelu(
            (conv): QuantizedConvReLU2d(40, 160, kernel_size=(1, 1), stride=(1, 1), scale=0.011912889778614044, zero_point=0)
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): QuantizedConv2d(160, 160, kernel_size=(5, 5), stride=(2, 2), scale=0.03991815075278282, zero_point=115, padding=(2, 2), groups=160)
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): QuantizedConvReLU2d(160, 40, kernel_size=(1, 1), stride=(1, 1), scale=0.0029640463180840015, zero_point=0)
                (relu): Identity()
              )
              (1): QuantizedConv2d(40, 160, kernel_size=(1, 1), stride=(1, 1), scale=0.0026679884176701307, zero_point=228)
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): QFunctional(
                scale=0.014385252259671688, zero_point=116
                (activation_post_process): Identity()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): QuantizedConv2d(160, 56, kernel_size=(1, 1), stride=(1, 1), scale=0.00793438870459795, zero_point=115)
          )
        )
        (fbnetv2_2_1): IRFBlock(
          (pw): ConvBNRelu(
            (conv): QuantizedConvReLU2d(56, 168, kernel_size=(1, 1), stride=(1, 1), scale=0.0010920437052845955, zero_point=0)
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): QuantizedConv2d(168, 168, kernel_size=(5, 5), stride=(1, 1), scale=0.0008342292276211083, zero_point=135, padding=(2, 2), groups=168)
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): QuantizedConvReLU2d(168, 40, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
                (relu): Identity()
              )
              (1): QuantizedConv2d(40, 168, kernel_size=(1, 1), stride=(1, 1), scale=6.375880911946297e-05, zero_point=98)
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): QFunctional(
                scale=0.00039093021769076586, zero_point=145
                (activation_post_process): Identity()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): QuantizedConv2d(168, 56, kernel_size=(1, 1), stride=(1, 1), scale=7.621428812853992e-05, zero_point=94)
          )
          (res_conn): TorchAdd(
            (add_func): QFunctional(
              scale=0.007963946089148521, zero_point=113
              (activation_post_process): Identity()
            )
          )
        )
        (fbnetv2_2_2): IRFBlock(
          (pw): ConvBNRelu(
            (conv): QuantizedConvReLU2d(56, 168, kernel_size=(1, 1), stride=(1, 1), scale=0.0010195026407018304, zero_point=0)
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): QuantizedConv2d(168, 168, kernel_size=(5, 5), stride=(1, 1), scale=0.0007936142501421273, zero_point=91, padding=(2, 2), groups=168)
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): QuantizedConvReLU2d(168, 40, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
                (relu): Identity()
              )
              (1): QuantizedConv2d(40, 168, kernel_size=(1, 1), stride=(1, 1), scale=7.277222175616771e-05, zero_point=95)
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): QFunctional(
                scale=0.00039561078301630914, zero_point=91
                (activation_post_process): Identity()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): QuantizedConv2d(168, 56, kernel_size=(1, 1), stride=(1, 1), scale=7.229163747979328e-05, zero_point=187)
          )
          (res_conn): TorchAdd(
            (add_func): QFunctional(
              scale=0.008027761243283749, zero_point=112
              (activation_post_process): Identity()
            )
          )
        )
        (fbnetv2_2_3): IRFBlock(
          (pw): ConvBNRelu(
            (conv): QuantizedConvReLU2d(56, 168, kernel_size=(1, 1), stride=(1, 1), scale=0.00027073072851635516, zero_point=0)
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): QuantizedConv2d(168, 168, kernel_size=(5, 5), stride=(1, 1), scale=0.00019253291247878224, zero_point=102, padding=(2, 2), groups=168)
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): QuantizedConvReLU2d(168, 40, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
                (relu): Identity()
              )
              (1): QuantizedConv2d(40, 168, kernel_size=(1, 1), stride=(1, 1), scale=6.987666711211205e-05, zero_point=132)
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): QFunctional(
                scale=9.661383228376508e-05, zero_point=102
                (activation_post_process): Identity()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): QuantizedConv2d(168, 56, kernel_size=(1, 1), stride=(1, 1), scale=1.6480340491398238e-05, zero_point=132)
          )
          (res_conn): TorchAdd(
            (add_func): QFunctional(
              scale=0.007980186492204666, zero_point=113
              (activation_post_process): Identity()
            )
          )
        )
        (fbnetv2_2_4): IRFBlock(
          (pw): ConvBNRelu(
            (conv): QuantizedConvReLU2d(56, 168, kernel_size=(1, 1), stride=(1, 1), scale=0.0005524504231289029, zero_point=0)
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): QuantizedConv2d(168, 168, kernel_size=(5, 5), stride=(1, 1), scale=0.0002400965749984607, zero_point=124, padding=(2, 2), groups=168)
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): QuantizedConvReLU2d(168, 40, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
                (relu): Identity()
              )
              (1): QuantizedConv2d(40, 168, kernel_size=(1, 1), stride=(1, 1), scale=8.812722080620006e-05, zero_point=73)
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): QFunctional(
                scale=0.00012484597391448915, zero_point=129
                (activation_post_process): Identity()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): QuantizedConv2d(168, 56, kernel_size=(1, 1), stride=(1, 1), scale=2.81129887298448e-05, zero_point=159)
          )
          (res_conn): TorchAdd(
            (add_func): QFunctional(
              scale=0.007957572117447853, zero_point=113
              (activation_post_process): Identity()
            )
          )
        )
      )
      (trunk3): Sequential(
        (fbnetv2_3_0): IRFBlock(
          (pw): ConvBNRelu(
            (conv): QuantizedConvReLU2d(56, 280, kernel_size=(1, 1), stride=(1, 1), scale=0.0012226185062900186, zero_point=0)
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): QuantizedConv2d(280, 280, kernel_size=(5, 5), stride=(2, 2), scale=0.001530179986730218, zero_point=175, padding=(2, 2), groups=280)
          )
          (pwl): ConvBNRelu(
            (conv): QuantizedConv2d(280, 104, kernel_size=(1, 1), stride=(1, 1), scale=0.0009373266948387027, zero_point=167)
          )
        )
        (fbnetv2_3_1): IRFBlock(
          (pw): ConvBNRelu(
            (conv): QuantizedConvReLU2d(104, 312, kernel_size=(1, 1), stride=(1, 1), scale=8.4582636191044e-05, zero_point=0)
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): QuantizedConv2d(312, 312, kernel_size=(3, 3), stride=(1, 1), scale=4.209706821711734e-05, zero_point=154, padding=(1, 1), groups=312)
          )
          (pwl): ConvBNRelu(
            (conv): QuantizedConv2d(312, 104, kernel_size=(1, 1), stride=(1, 1), scale=8.65069159772247e-06, zero_point=122)
          )
          (res_conn): TorchAdd(
            (add_func): QFunctional(
              scale=0.0009342883713543415, zero_point=168
              (activation_post_process): Identity()
            )
          )
        )
        (fbnetv2_3_2): IRFBlock(
          (pw): ConvBNRelu(
            (conv): QuantizedConvReLU2d(104, 312, kernel_size=(1, 1), stride=(1, 1), scale=6.381989805959165e-05, zero_point=0)
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): QuantizedConv2d(312, 312, kernel_size=(3, 3), stride=(1, 1), scale=1.539893310109619e-05, zero_point=145, padding=(1, 1), groups=312)
          )
          (pwl): ConvBNRelu(
            (conv): QuantizedConv2d(312, 104, kernel_size=(1, 1), stride=(1, 1), scale=2.219987891294295e-06, zero_point=152)
          )
          (res_conn): TorchAdd(
            (add_func): QFunctional(
              scale=0.0009397048270329833, zero_point=167
              (activation_post_process): Identity()
            )
          )
        )
        (fbnetv2_3_3): IRFBlock(
          (pw): ConvBNRelu(
            (conv): QuantizedConvReLU2d(104, 312, kernel_size=(1, 1), stride=(1, 1), scale=0.00010755240509752184, zero_point=0)
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): QuantizedConv2d(312, 312, kernel_size=(3, 3), stride=(1, 1), scale=4.085125692654401e-05, zero_point=47, padding=(1, 1), groups=312)
          )
          (pwl): ConvBNRelu(
            (conv): QuantizedConv2d(312, 104, kernel_size=(1, 1), stride=(1, 1), scale=9.55848372541368e-06, zero_point=94)
          )
          (res_conn): TorchAdd(
            (add_func): QFunctional(
              scale=0.0009397313697263598, zero_point=167
              (activation_post_process): Identity()
            )
          )
        )
        (fbnetv2_3_4): IRFBlock(
          (pw): ConvBNRelu(
            (conv): QuantizedConvReLU2d(104, 312, kernel_size=(1, 1), stride=(1, 1), scale=3.660437505459413e-05, zero_point=0)
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): QuantizedConv2d(312, 312, kernel_size=(3, 3), stride=(1, 1), scale=1.963492832146585e-05, zero_point=154, padding=(1, 1), groups=312)
          )
          (pwl): ConvBNRelu(
            (conv): QuantizedConv2d(312, 104, kernel_size=(1, 1), stride=(1, 1), scale=3.0341177534864983e-06, zero_point=132)
          )
          (res_conn): TorchAdd(
            (add_func): QFunctional(
              scale=0.0009310279274359345, zero_point=168
              (activation_post_process): Identity()
            )
          )
        )
        (fbnetv2_3_5): IRFBlock(
          (pw): ConvBNRelu(
            (conv): QuantizedConvReLU2d(104, 520, kernel_size=(1, 1), stride=(1, 1), scale=0.00018172827549278736, zero_point=0)
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): QuantizedConv2d(520, 520, kernel_size=(3, 3), stride=(1, 1), scale=7.848698442103341e-05, zero_point=116, padding=(1, 1), groups=520)
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): QuantizedConvReLU2d(520, 128, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
                (relu): Identity()
              )
              (1): QuantizedConv2d(128, 520, kernel_size=(1, 1), stride=(1, 1), scale=0.0001210664413520135, zero_point=85)
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): QFunctional(
                scale=3.9188191294670105e-05, zero_point=116
                (activation_post_process): Identity()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): QuantizedConv2d(520, 160, kernel_size=(1, 1), stride=(1, 1), scale=1.890981184260454e-05, zero_point=97)
          )
        )
        (fbnetv2_3_6): IRFBlock(
          (pw): ConvBNRelu(
            (conv): QuantizedConvReLU2d(160, 480, kernel_size=(1, 1), stride=(1, 1), scale=1.911950676003471e-06, zero_point=0)
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): QuantizedConv2d(480, 480, kernel_size=(5, 5), stride=(1, 1), scale=1.5018854355730582e-06, zero_point=190, padding=(2, 2), groups=480)
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): QuantizedConvReLU2d(480, 120, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
                (relu): Identity()
              )
              (1): QuantizedConv2d(120, 480, kernel_size=(1, 1), stride=(1, 1), scale=7.200046820798889e-05, zero_point=101)
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): QFunctional(
                scale=7.540355682067457e-07, zero_point=190
                (activation_post_process): Identity()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): QuantizedConv2d(480, 160, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=121)
          )
          (res_conn): TorchAdd(
            (add_func): QFunctional(
              scale=1.889141640276648e-05, zero_point=97
              (activation_post_process): Identity()
            )
          )
        )
        (fbnetv2_3_7): IRFBlock(
          (pw): ConvBNRelu(
            (conv): QuantizedConvReLU2d(160, 480, kernel_size=(1, 1), stride=(1, 1), scale=1.2875838137915707e-06, zero_point=0)
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): QuantizedConv2d(480, 480, kernel_size=(5, 5), stride=(1, 1), scale=1.3095192343826056e-06, zero_point=138, padding=(2, 2), groups=480)
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): QuantizedConvReLU2d(480, 120, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
                (relu): Identity()
              )
              (1): QuantizedConv2d(120, 480, kernel_size=(1, 1), stride=(1, 1), scale=6.131405098130926e-05, zero_point=89)
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): QFunctional(
                scale=5.939684228906117e-07, zero_point=153
                (activation_post_process): Identity()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): QuantizedConv2d(480, 160, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=61)
          )
          (res_conn): TorchAdd(
            (add_func): QFunctional(
              scale=1.8568976884125732e-05, zero_point=99
              (activation_post_process): Identity()
            )
          )
        )
        (fbnetv2_3_8): IRFBlock(
          (pw): ConvBNRelu(
            (conv): QuantizedConvReLU2d(160, 480, kernel_size=(1, 1), stride=(1, 1), scale=1.6371755009458866e-06, zero_point=0)
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): QuantizedConv2d(480, 480, kernel_size=(5, 5), stride=(1, 1), scale=1.3133361562722712e-06, zero_point=103, padding=(2, 2), groups=480)
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): QuantizedConvReLU2d(480, 120, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
                (relu): Identity()
              )
              (1): QuantizedConv2d(120, 480, kernel_size=(1, 1), stride=(1, 1), scale=0.00010028655378846452, zero_point=61)
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): QFunctional(
                scale=6.430141183955129e-07, zero_point=106
                (activation_post_process): Identity()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): QuantizedConv2d(480, 160, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=100)
          )
          (res_conn): TorchAdd(
            (add_func): QFunctional(
              scale=1.8575032299850136e-05, zero_point=99
              (activation_post_process): Identity()
            )
          )
        )
        (fbnetv2_3_9): IRFBlock(
          (pw): ConvBNRelu(
            (conv): QuantizedConvReLU2d(160, 480, kernel_size=(1, 1), stride=(1, 1), scale=1.6438972352261771e-06, zero_point=0)
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): QuantizedConv2d(480, 480, kernel_size=(5, 5), stride=(1, 1), scale=1.1340312084939796e-06, zero_point=149, padding=(2, 2), groups=480)
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): QuantizedConvReLU2d(480, 120, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
                (relu): Identity()
              )
              (1): QuantizedConv2d(120, 480, kernel_size=(1, 1), stride=(1, 1), scale=8.859753870638087e-05, zero_point=57)
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): QFunctional(
                scale=5.161143121767964e-07, zero_point=157
                (activation_post_process): Identity()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): QuantizedConv2d(480, 160, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=67)
          )
          (res_conn): TorchAdd(
            (add_func): QFunctional(
              scale=1.8881957657868043e-05, zero_point=97
              (activation_post_process): Identity()
            )
          )
        )
        (fbnetv2_3_10): IRFBlock(
          (pw): ConvBNRelu(
            (conv): QuantizedConvReLU2d(160, 480, kernel_size=(1, 1), stride=(1, 1), scale=1.4282558140621404e-06, zero_point=0)
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): QuantizedConv2d(480, 480, kernel_size=(5, 5), stride=(1, 1), scale=8.962684887592332e-07, zero_point=156, padding=(2, 2), groups=480)
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): QuantizedConvReLU2d(480, 120, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
                (relu): Identity()
              )
              (1): QuantizedConv2d(120, 480, kernel_size=(1, 1), stride=(1, 1), scale=0.00012169643741799518, zero_point=50)
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): QFunctional(
                scale=4.6200705128285335e-07, zero_point=152
                (activation_post_process): Identity()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): QuantizedConv2d(480, 160, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=48)
          )
          (res_conn): TorchAdd(
            (add_func): QFunctional(
              scale=1.895795139716938e-05, zero_point=98
              (activation_post_process): Identity()
            )
          )
        )
        (fbnetv2_3_11): IRFBlock(
          (pw): ConvBNRelu(
            (conv): QuantizedConvReLU2d(160, 480, kernel_size=(1, 1), stride=(1, 1), scale=1.2621263749679201e-06, zero_point=0)
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): QuantizedConv2d(480, 480, kernel_size=(5, 5), stride=(1, 1), scale=1.1380574278518907e-06, zero_point=128, padding=(2, 2), groups=480)
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): QuantizedConvReLU2d(480, 120, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
                (relu): Identity()
              )
              (1): QuantizedConv2d(120, 480, kernel_size=(1, 1), stride=(1, 1), scale=8.019566303119063e-05, zero_point=61)
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): QFunctional(
                scale=5.698773861695372e-07, zero_point=128
                (activation_post_process): Identity()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): QuantizedConv2d(480, 160, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=101)
          )
          (res_conn): TorchAdd(
            (add_func): QFunctional(
              scale=1.8985765564139e-05, zero_point=98
              (activation_post_process): Identity()
            )
          )
        )
        (fbnetv2_3_12): IRFBlock(
          (pw): ConvBNRelu(
            (conv): QuantizedConvReLU2d(160, 480, kernel_size=(1, 1), stride=(1, 1), scale=2.3649929516977863e-06, zero_point=0)
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): QuantizedConv2d(480, 480, kernel_size=(5, 5), stride=(1, 1), scale=1.8494765754439868e-06, zero_point=110, padding=(2, 2), groups=480)
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): QuantizedConvReLU2d(480, 120, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
                (relu): Identity()
              )
              (1): QuantizedConv2d(120, 480, kernel_size=(1, 1), stride=(1, 1), scale=0.00010181586549151689, zero_point=53)
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): QFunctional(
                scale=9.809293715079548e-07, zero_point=104
                (activation_post_process): Identity()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): QuantizedConv2d(480, 160, kernel_size=(1, 1), stride=(1, 1), scale=1.2404890981088101e-07, zero_point=127)
          )
          (res_conn): TorchAdd(
            (add_func): QFunctional(
              scale=1.8990054741152562e-05, zero_point=99
              (activation_post_process): Identity()
            )
          )
        )
        (fbnetv2_3_13): IRFBlock(
          (pw): ConvBNRelu(
            (conv): QuantizedConvReLU2d(160, 480, kernel_size=(1, 1), stride=(1, 1), scale=2.0782551928277826e-06, zero_point=0)
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): QuantizedConv2d(480, 480, kernel_size=(5, 5), stride=(1, 1), scale=1.499627614975907e-06, zero_point=89, padding=(2, 2), groups=480)
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): QuantizedConvReLU2d(480, 120, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
                (relu): Identity()
              )
              (1): QuantizedConv2d(120, 480, kernel_size=(1, 1), stride=(1, 1), scale=0.00010415654833195731, zero_point=65)
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): QFunctional(
                scale=7.371511401288444e-07, zero_point=86
                (activation_post_process): Identity()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): QuantizedConv2d(480, 160, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=85)
          )
          (res_conn): TorchAdd(
            (add_func): QFunctional(
              scale=1.8988346710102633e-05, zero_point=99
              (activation_post_process): Identity()
            )
          )
        )
      )
      (trunk4): Sequential(
        (fbnetv2_4_0): IRFBlock(
          (pw): ConvBNRelu(
            (conv): QuantizedConvReLU2d(160, 960, kernel_size=(1, 1), stride=(1, 1), scale=2.611196805446525e-06, zero_point=0)
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): QuantizedConv2d(960, 960, kernel_size=(3, 3), stride=(2, 2), scale=2.173478151235031e-06, zero_point=107, padding=(1, 1), groups=960)
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): QuantizedConvReLU2d(960, 240, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
                (relu): Identity()
              )
              (1): QuantizedConv2d(240, 960, kernel_size=(1, 1), stride=(1, 1), scale=8.760602213442326e-05, zero_point=82)
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): QFunctional(
                scale=1.2160244295955636e-06, zero_point=110
                (activation_post_process): Identity()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): QuantizedConv2d(960, 264, kernel_size=(1, 1), stride=(1, 1), scale=5.608720812233514e-07, zero_point=75)
          )
        )
        (fbnetv2_4_1): IRFBlock(
          (pw): ConvBNRelu(
            (conv): QuantizedConvReLU2d(264, 1320, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): QuantizedConv2d(1320, 1320, kernel_size=(5, 5), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=63, padding=(2, 2), groups=1320)
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): QuantizedConvReLU2d(1320, 328, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
                (relu): Identity()
              )
              (1): QuantizedConv2d(328, 1320, kernel_size=(1, 1), stride=(1, 1), scale=6.037768616806716e-05, zero_point=74)
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): QFunctional(
                scale=1.1920928955078125e-07, zero_point=32
                (activation_post_process): Identity()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): QuantizedConv2d(1320, 264, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=5)
          )
          (res_conn): TorchAdd(
            (add_func): QFunctional(
              scale=5.751385856456182e-07, zero_point=74
              (activation_post_process): Identity()
            )
          )
        )
        (fbnetv2_4_2): IRFBlock(
          (pw): ConvBNRelu(
            (conv): QuantizedConvReLU2d(264, 1320, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): QuantizedConv2d(1320, 1320, kernel_size=(5, 5), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=23, padding=(2, 2), groups=1320)
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): QuantizedConvReLU2d(1320, 328, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
                (relu): Identity()
              )
              (1): QuantizedConv2d(328, 1320, kernel_size=(1, 1), stride=(1, 1), scale=6.264840340008959e-05, zero_point=61)
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): QFunctional(
                scale=1.1920928955078125e-07, zero_point=12
                (activation_post_process): Identity()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): QuantizedConv2d(1320, 264, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=2)
          )
          (res_conn): TorchAdd(
            (add_func): QFunctional(
              scale=5.754035896643472e-07, zero_point=74
              (activation_post_process): Identity()
            )
          )
        )
        (fbnetv2_4_3): IRFBlock(
          (pw): ConvBNRelu(
            (conv): QuantizedConvReLU2d(264, 1320, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): QuantizedConv2d(1320, 1320, kernel_size=(5, 5), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=14, padding=(2, 2), groups=1320)
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): QuantizedConvReLU2d(1320, 328, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
                (relu): Identity()
              )
              (1): QuantizedConv2d(328, 1320, kernel_size=(1, 1), stride=(1, 1), scale=6.452084926422685e-05, zero_point=81)
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): QFunctional(
                scale=1.1920928955078125e-07, zero_point=7
                (activation_post_process): Identity()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): QuantizedConv2d(1320, 264, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=1)
          )
          (res_conn): TorchAdd(
            (add_func): QFunctional(
              scale=5.751657567998336e-07, zero_point=74
              (activation_post_process): Identity()
            )
          )
        )
        (fbnetv2_4_4): IRFBlock(
          (pw): ConvBNRelu(
            (conv): QuantizedConvReLU2d(264, 1320, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): QuantizedConv2d(1320, 1320, kernel_size=(5, 5), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=9, padding=(2, 2), groups=1320)
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): QuantizedConvReLU2d(1320, 328, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
                (relu): Identity()
              )
              (1): QuantizedConv2d(328, 1320, kernel_size=(1, 1), stride=(1, 1), scale=8.022618567338213e-05, zero_point=42)
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): QFunctional(
                scale=1.1920928955078125e-07, zero_point=5
                (activation_post_process): Identity()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): QuantizedConv2d(1320, 264, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
          )
          (res_conn): TorchAdd(
            (add_func): QFunctional(
              scale=5.751547860199935e-07, zero_point=74
              (activation_post_process): Identity()
            )
          )
        )
        (fbnetv2_4_5): IRFBlock(
          (pw): ConvBNRelu(
            (conv): QuantizedConvReLU2d(264, 1320, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): QuantizedConv2d(1320, 1320, kernel_size=(5, 5), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=17, padding=(2, 2), groups=1320)
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): QuantizedConvReLU2d(1320, 328, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
                (relu): Identity()
              )
              (1): QuantizedConv2d(328, 1320, kernel_size=(1, 1), stride=(1, 1), scale=6.953460251679644e-05, zero_point=52)
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): QFunctional(
                scale=1.1920928955078125e-07, zero_point=8
                (activation_post_process): Identity()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): QuantizedConv2d(1320, 264, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=2)
          )
          (res_conn): TorchAdd(
            (add_func): QFunctional(
              scale=5.747066325056949e-07, zero_point=74
              (activation_post_process): Identity()
            )
          )
        )
        (fbnetv2_4_6): IRFBlock(
          (pw): ConvBNRelu(
            (conv): QuantizedConvReLU2d(264, 1320, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): QuantizedConv2d(1320, 1320, kernel_size=(5, 5), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=32, padding=(2, 2), groups=1320)
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): QuantizedConvReLU2d(1320, 328, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
                (relu): Identity()
              )
              (1): QuantizedConv2d(328, 1320, kernel_size=(1, 1), stride=(1, 1), scale=7.979892689036205e-05, zero_point=39)
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): QFunctional(
                scale=1.1920928955078125e-07, zero_point=16
                (activation_post_process): Identity()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): QuantizedConv2d(1320, 264, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=3)
          )
          (res_conn): TorchAdd(
            (add_func): QFunctional(
              scale=5.71201837828994e-07, zero_point=73
              (activation_post_process): Identity()
            )
          )
        )
        (fbnetv2_4_7): IRFBlock(
          (pw): ConvBNRelu(
            (conv): QuantizedConvReLU2d(264, 1584, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): QuantizedConv2d(1584, 1584, kernel_size=(5, 5), stride=(1, 1), scale=5.027031306781282e-07, zero_point=103, padding=(2, 2), groups=1584)
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): QuantizedConvReLU2d(1584, 400, kernel_size=(1, 1), stride=(1, 1), scale=0.00021970877423882484, zero_point=0)
                (relu): Identity()
              )
              (1): QuantizedConv2d(400, 1584, kernel_size=(1, 1), stride=(1, 1), scale=0.0008652499527670443, zero_point=229)
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): QFunctional(
                scale=2.3715318775430205e-07, zero_point=103
                (activation_post_process): Identity()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): QuantizedConv2d(1584, 288, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=48)
          )
        )
        (fbnetv2_4_8): IRFBlock(
          (pw): ConvBNRelu(
            (conv): QuantizedConvReLU2d(288, 1728, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
            (relu): Identity()
          )
          (dw): ConvBNRelu(
            (conv): QuantizedConv2d(1728, 1728, kernel_size=(5, 5), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=3, padding=(2, 2), groups=1728)
          )
          (se): SEModule(
            (avg_pool): AdaptiveAvgPool2d(output_size=1)
            (se): Sequential(
              (0): ConvBNRelu(
                (conv): QuantizedConvReLU2d(1728, 432, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
                (relu): Identity()
              )
              (1): QuantizedConv2d(432, 1728, kernel_size=(1, 1), stride=(1, 1), scale=7.031091081444174e-05, zero_point=89)
              (2): Sigmoid()
            )
            (mul): TorchMultiply(
              (mul_func): QFunctional(
                scale=1.1920928955078125e-07, zero_point=2
                (activation_post_process): Identity()
              )
            )
          )
          (pwl): ConvBNRelu(
            (conv): QuantizedConv2d(1728, 288, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
          )
          (res_conn): TorchAdd(
            (add_func): QFunctional(
              scale=1.1920928955078125e-07, zero_point=48
              (activation_post_process): Identity()
            )
          )
        )
      )
    )
    (quant_stubs): QuantStubNested(
      (stubs): ModuleList(
        (0): Quantize(scale=tensor([1.0769]), zero_point=tensor([115]), dtype=torch.quint8)
      )
    )
    (dequant_stubs): QuantStubNested(
      (stubs): ModuleList(
        (0): DeQuantize()
        (1): DeQuantize()
        (2): DeQuantize()
        (3): DeQuantize()
        (4): DeQuantize()
      )
    )
  )
  (proposal_generator): RPN(
    (rpn_head): QuantWrapSubClass(
      (rpn_feature): FBNetModule(
        (0): Sequential(
          (fbnetv2_0_0): IRFBlock(
            (pw): ConvBNRelu(
              (conv): QuantizedConvReLU2d(128, 384, kernel_size=(1, 1), stride=(1, 1), scale=0.0005485323490574956, zero_point=0)
              (relu): Identity()
            )
            (dw): ConvBNRelu(
              (conv): QuantizedConv2d(384, 384, kernel_size=(5, 5), stride=(1, 1), scale=0.00043976091546937823, zero_point=139, padding=(2, 2), groups=384)
            )
            (se): SEModule(
              (avg_pool): AdaptiveAvgPool2d(output_size=1)
              (se): Sequential(
                (0): ConvBNRelu(
                  (conv): QuantizedConvReLU2d(384, 96, kernel_size=(1, 1), stride=(1, 1), scale=0.00013158073124941438, zero_point=0)
                  (relu): Identity()
                )
                (1): QuantizedConv2d(96, 384, kernel_size=(1, 1), stride=(1, 1), scale=0.0005567624466493726, zero_point=185)
                (2): Sigmoid()
              )
              (mul): TorchMultiply(
                (mul_func): QFunctional(
                  scale=0.00019988293934147805, zero_point=126
                  (activation_post_process): Identity()
                )
              )
            )
            (pwl): ConvBNRelu(
              (conv): QuantizedConv2d(384, 160, kernel_size=(1, 1), stride=(1, 1), scale=4.479621202335693e-05, zero_point=125)
            )
          )
        )
      )
      (rpn_regressor): RPNHeadConvRegressor(
        (cls_logits): QuantizedConv2d(160, 3, kernel_size=(1, 1), stride=(1, 1), scale=0.0011902087135240436, zero_point=38)
        (bbox_pred): QuantizedConv2d(160, 12, kernel_size=(1, 1), stride=(1, 1), scale=0.0003453920071478933, zero_point=231)
      )
      (quant_stubs): QuantStubNested(
        (stubs): ModuleList(
          (0): Quantize(scale=tensor([0.0031]), zero_point=tensor([119]), dtype=torch.quint8)
          (1): Quantize(scale=tensor([0.0028]), zero_point=tensor([178]), dtype=torch.quint8)
          (2): Quantize(scale=tensor([9.3984e-06]), zero_point=tensor([144]), dtype=torch.quint8)
          (3): Quantize(scale=tensor([1.1921e-07]), zero_point=tensor([18]), dtype=torch.quint8)
          (4): Quantize(scale=tensor([1.1921e-07]), zero_point=tensor([17]), dtype=torch.quint8)
        )
      )
      (dequant_stubs): QuantStubNested(
        (stubs): ModuleList(
          (0): DeQuantize()
          (1): DeQuantize()
          (2): DeQuantize()
          (3): DeQuantize()
          (4): DeQuantize()
          (5): DeQuantize()
          (6): DeQuantize()
          (7): DeQuantize()
          (8): DeQuantize()
          (9): DeQuantize()
        )
      )
    )
    (anchor_generator): DefaultAnchorGenerator(
      (cell_anchors): BufferList()
    )
  )
  (roi_heads): StandardROIHeads(
    (box_pooler): ROIPooler(
      (level_poolers): ModuleList(
        (0): ROIAlign(output_size=(6, 6), spatial_scale=0.125, sampling_ratio=0, aligned=True)
        (1): ROIAlign(output_size=(6, 6), spatial_scale=0.0625, sampling_ratio=0, aligned=True)
        (2): ROIAlign(output_size=(6, 6), spatial_scale=0.03125, sampling_ratio=0, aligned=True)
        (3): ROIAlign(output_size=(6, 6), spatial_scale=0.015625, sampling_ratio=0, aligned=True)
      )
    )
    (box_head): QuantWrapSubClass(
      (roi_box_conv): FBNetModule(
        (0): Sequential(
          (fbnetv2_0_0): IRFBlock(
            (pw): ConvBNRelu(
              (conv): QuantizedConvReLU2d(128, 768, kernel_size=(1, 1), stride=(1, 1), scale=0.0005679927417077124, zero_point=0)
              (relu): Identity()
            )
            (dw): ConvBNRelu(
              (conv): QuantizedConv2d(768, 768, kernel_size=(3, 3), stride=(2, 2), scale=0.0003521842008922249, zero_point=150, padding=(1, 1), groups=768)
            )
            (se): SEModule(
              (avg_pool): AdaptiveAvgPool2d(output_size=1)
              (se): Sequential(
                (0): ConvBNRelu(
                  (conv): QuantizedConvReLU2d(768, 192, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
                  (relu): Identity()
                )
                (1): QuantizedConv2d(192, 768, kernel_size=(1, 1), stride=(1, 1), scale=6.309056334430352e-05, zero_point=94)
                (2): Sigmoid()
              )
              (mul): TorchMultiply(
                (mul_func): QFunctional(
                  scale=0.00017615345132071525, zero_point=150
                  (activation_post_process): Identity()
                )
              )
            )
            (pwl): ConvBNRelu(
              (conv): QuantizedConv2d(768, 264, kernel_size=(1, 1), stride=(1, 1), scale=5.428988879430108e-05, zero_point=143)
            )
          )
          (fbnetv2_0_1): IRFBlock(
            (pw): ConvBNRelu(
              (conv): QuantizedConvReLU2d(264, 1320, kernel_size=(1, 1), stride=(1, 1), scale=5.013116151530994e-06, zero_point=0)
              (relu): Identity()
            )
            (dw): ConvBNRelu(
              (conv): QuantizedConv2d(1320, 1320, kernel_size=(5, 5), stride=(1, 1), scale=7.747900667709473e-07, zero_point=115, padding=(2, 2), groups=1320)
            )
            (se): SEModule(
              (avg_pool): AdaptiveAvgPool2d(output_size=1)
              (se): Sequential(
                (0): ConvBNRelu(
                  (conv): QuantizedConvReLU2d(1320, 328, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
                  (relu): Identity()
                )
                (1): QuantizedConv2d(328, 1320, kernel_size=(1, 1), stride=(1, 1), scale=3.8755340938223526e-05, zero_point=102)
                (2): Sigmoid()
              )
              (mul): TorchMultiply(
                (mul_func): QFunctional(
                  scale=3.875728680213797e-07, zero_point=115
                  (activation_post_process): Identity()
                )
              )
            )
            (pwl): ConvBNRelu(
              (conv): QuantizedConv2d(1320, 264, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=108)
            )
            (res_conn): TorchAdd(
              (add_func): QFunctional(
                scale=5.4282772907754406e-05, zero_point=143
                (activation_post_process): Identity()
              )
            )
          )
          (fbnetv2_0_2): IRFBlock(
            (pw): ConvBNRelu(
              (conv): QuantizedConvReLU2d(264, 1320, kernel_size=(1, 1), stride=(1, 1), scale=3.1310037229559384e-06, zero_point=0)
              (relu): Identity()
            )
            (dw): ConvBNRelu(
              (conv): QuantizedConv2d(1320, 1320, kernel_size=(5, 5), stride=(1, 1), scale=9.77845161287405e-07, zero_point=107, padding=(2, 2), groups=1320)
            )
            (se): SEModule(
              (avg_pool): AdaptiveAvgPool2d(output_size=1)
              (se): Sequential(
                (0): ConvBNRelu(
                  (conv): QuantizedConvReLU2d(1320, 328, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
                  (relu): Identity()
                )
                (1): QuantizedConv2d(328, 1320, kernel_size=(1, 1), stride=(1, 1), scale=9.591537673259154e-05, zero_point=75)
                (2): Sigmoid()
              )
              (mul): TorchMultiply(
                (mul_func): QFunctional(
                  scale=4.889765250482014e-07, zero_point=107
                  (activation_post_process): Identity()
                )
              )
            )
            (pwl): ConvBNRelu(
              (conv): QuantizedConv2d(1320, 264, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=62)
            )
            (res_conn): TorchAdd(
              (add_func): QFunctional(
                scale=5.4291394917527214e-05, zero_point=143
                (activation_post_process): Identity()
              )
            )
          )
          (fbnetv2_0_3): IRFBlock(
            (pw): ConvBNRelu(
              (conv): QuantizedConvReLU2d(264, 1320, kernel_size=(1, 1), stride=(1, 1), scale=4.679118319472764e-06, zero_point=0)
              (relu): Identity()
            )
            (dw): ConvBNRelu(
              (conv): QuantizedConv2d(1320, 1320, kernel_size=(5, 5), stride=(1, 1), scale=1.4510977734971675e-06, zero_point=142, padding=(2, 2), groups=1320)
            )
            (se): SEModule(
              (avg_pool): AdaptiveAvgPool2d(output_size=1)
              (se): Sequential(
                (0): ConvBNRelu(
                  (conv): QuantizedConvReLU2d(1320, 328, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
                  (relu): Identity()
                )
                (1): QuantizedConv2d(328, 1320, kernel_size=(1, 1), stride=(1, 1), scale=4.699787314166315e-05, zero_point=74)
                (2): Sigmoid()
              )
              (mul): TorchMultiply(
                (mul_func): QFunctional(
                  scale=8.208148187804909e-07, zero_point=144
                  (activation_post_process): Identity()
                )
              )
            )
            (pwl): ConvBNRelu(
              (conv): QuantizedConv2d(1320, 264, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=77)
            )
            (res_conn): TorchAdd(
              (add_func): QFunctional(
                scale=5.4277472372632474e-05, zero_point=143
                (activation_post_process): Identity()
              )
            )
          )
          (fbnetv2_0_4): IRFBlock(
            (pw): ConvBNRelu(
              (conv): QuantizedConvReLU2d(264, 1320, kernel_size=(1, 1), stride=(1, 1), scale=4.639050985133508e-06, zero_point=0)
              (relu): Identity()
            )
            (dw): ConvBNRelu(
              (conv): QuantizedConv2d(1320, 1320, kernel_size=(5, 5), stride=(1, 1), scale=1.0215067050012294e-06, zero_point=91, padding=(2, 2), groups=1320)
            )
            (se): SEModule(
              (avg_pool): AdaptiveAvgPool2d(output_size=1)
              (se): Sequential(
                (0): ConvBNRelu(
                  (conv): QuantizedConvReLU2d(1320, 328, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
                  (relu): Identity()
                )
                (1): QuantizedConv2d(328, 1320, kernel_size=(1, 1), stride=(1, 1), scale=0.00013359281001612544, zero_point=95)
                (2): Sigmoid()
              )
              (mul): TorchMultiply(
                (mul_func): QFunctional(
                  scale=4.68318120283584e-07, zero_point=85
                  (activation_post_process): Identity()
                )
              )
            )
            (pwl): ConvBNRelu(
              (conv): QuantizedConv2d(1320, 264, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=48)
            )
            (res_conn): TorchAdd(
              (add_func): QFunctional(
                scale=5.42697380296886e-05, zero_point=143
                (activation_post_process): Identity()
              )
            )
          )
          (fbnetv2_0_5): IRFBlock(
            (pw): ConvBNRelu(
              (conv): QuantizedConvReLU2d(264, 1320, kernel_size=(1, 1), stride=(1, 1), scale=2.2146978153614327e-06, zero_point=0)
              (relu): Identity()
            )
            (dw): ConvBNRelu(
              (conv): QuantizedConv2d(1320, 1320, kernel_size=(5, 5), stride=(1, 1), scale=8.195603982130706e-07, zero_point=159, padding=(2, 2), groups=1320)
            )
            (se): SEModule(
              (avg_pool): AdaptiveAvgPool2d(output_size=1)
              (se): Sequential(
                (0): ConvBNRelu(
                  (conv): QuantizedConvReLU2d(1320, 328, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
                  (relu): Identity()
                )
                (1): QuantizedConv2d(328, 1320, kernel_size=(1, 1), stride=(1, 1), scale=5.148678974364884e-05, zero_point=54)
                (2): Sigmoid()
              )
              (mul): TorchMultiply(
                (mul_func): QFunctional(
                  scale=4.1087068325396103e-07, zero_point=159
                  (activation_post_process): Identity()
                )
              )
            )
            (pwl): ConvBNRelu(
              (conv): QuantizedConv2d(1320, 264, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=49)
            )
            (res_conn): TorchAdd(
              (add_func): QFunctional(
                scale=5.4271928092930466e-05, zero_point=143
                (activation_post_process): Identity()
              )
            )
          )
          (fbnetv2_0_6): IRFBlock(
            (pw): ConvBNRelu(
              (conv): QuantizedConvReLU2d(264, 1320, kernel_size=(1, 1), stride=(1, 1), scale=4.5246219997352455e-06, zero_point=0)
              (relu): Identity()
            )
            (dw): ConvBNRelu(
              (conv): QuantizedConv2d(1320, 1320, kernel_size=(5, 5), stride=(1, 1), scale=1.3171294312996906e-06, zero_point=136, padding=(2, 2), groups=1320)
            )
            (se): SEModule(
              (avg_pool): AdaptiveAvgPool2d(output_size=1)
              (se): Sequential(
                (0): ConvBNRelu(
                  (conv): QuantizedConvReLU2d(1320, 328, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
                  (relu): Identity()
                )
                (1): QuantizedConv2d(328, 1320, kernel_size=(1, 1), stride=(1, 1), scale=0.00010152328468393534, zero_point=12)
                (2): Sigmoid()
              )
              (mul): TorchMultiply(
                (mul_func): QFunctional(
                  scale=6.953396223252639e-07, zero_point=142
                  (activation_post_process): Identity()
                )
              )
            )
            (pwl): ConvBNRelu(
              (conv): QuantizedConv2d(1320, 264, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=69)
            )
            (res_conn): TorchAdd(
              (add_func): QFunctional(
                scale=5.332106229616329e-05, zero_point=140
                (activation_post_process): Identity()
              )
            )
          )
          (fbnetv2_0_7): IRFBlock(
            (pw): ConvBNRelu(
              (conv): QuantizedConvReLU2d(264, 1584, kernel_size=(1, 1), stride=(1, 1), scale=5.61286606171052e-06, zero_point=0)
              (relu): Identity()
            )
            (dw): ConvBNRelu(
              (conv): QuantizedConv2d(1584, 1584, kernel_size=(5, 5), stride=(1, 1), scale=1.8154662484448636e-06, zero_point=153, padding=(2, 2), groups=1584)
            )
            (se): SEModule(
              (avg_pool): AdaptiveAvgPool2d(output_size=1)
              (se): Sequential(
                (0): ConvBNRelu(
                  (conv): QuantizedConvReLU2d(1584, 400, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
                  (relu): Identity()
                )
                (1): QuantizedConv2d(400, 1584, kernel_size=(1, 1), stride=(1, 1), scale=0.00010357669088989496, zero_point=128)
                (2): Sigmoid()
              )
              (mul): TorchMultiply(
                (mul_func): QFunctional(
                  scale=1.0115625173057197e-06, zero_point=137
                  (activation_post_process): Identity()
                )
              )
            )
            (pwl): ConvBNRelu(
              (conv): QuantizedConv2d(1584, 288, kernel_size=(1, 1), stride=(1, 1), scale=3.674675213005685e-07, zero_point=192)
            )
          )
          (fbnetv2_0_8): IRFBlock(
            (pw): ConvBNRelu(
              (conv): QuantizedConvReLU2d(288, 1728, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
              (relu): Identity()
            )
            (dw): ConvBNRelu(
              (conv): QuantizedConv2d(1728, 1728, kernel_size=(5, 5), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=7, padding=(2, 2), groups=1728)
            )
            (se): SEModule(
              (avg_pool): AdaptiveAvgPool2d(output_size=1)
              (se): Sequential(
                (0): ConvBNRelu(
                  (conv): QuantizedConvReLU2d(1728, 432, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=0)
                  (relu): Identity()
                )
                (1): QuantizedConv2d(432, 1728, kernel_size=(1, 1), stride=(1, 1), scale=0.0002358680940233171, zero_point=140)
                (2): Sigmoid()
              )
              (mul): TorchMultiply(
                (mul_func): QFunctional(
                  scale=1.1920928955078125e-07, zero_point=3
                  (activation_post_process): Identity()
                )
              )
            )
            (pwl): ConvBNRelu(
              (conv): QuantizedConv2d(1728, 288, kernel_size=(1, 1), stride=(1, 1), scale=1.1920928955078125e-07, zero_point=1)
            )
            (res_conn): TorchAdd(
              (add_func): QFunctional(
                scale=3.6752527421413106e-07, zero_point=192
                (activation_post_process): Identity()
              )
            )
          )
        )
      )
      (avgpool): AdaptiveAvgPool2d(output_size=1)
      (quant_stubs): QuantStubNested(
        (stubs): ModuleList(
          (0): Quantize(scale=tensor([0.0028]), zero_point=tensor([186]), dtype=torch.quint8)
        )
      )
      (dequant_stubs): QuantStubNested(
        (stubs): ModuleList(
          (0): DeQuantize()
        )
      )
    )
    (box_predictor): QuantWrapSubClass(
      (cls_score): QuantizedLinear(in_features=288, out_features=2, scale=2.147438067368057e-07, zero_point=127, qscheme=torch.per_tensor_affine)
      (bbox_pred): QuantizedLinear(in_features=288, out_features=4, scale=1.1920928955078125e-07, zero_point=4, qscheme=torch.per_tensor_affine)
      (quant_stubs): QuantStubNested(
        (stubs): ModuleList(
          (0): Quantize(scale=tensor([3.5167e-07]), zero_point=tensor([195]), dtype=torch.quint8)
        )
      )
      (dequant_stubs): QuantStubNested(
        (stubs): ModuleList(
          (0): DeQuantize()
          (1): DeQuantize()
        )
      )
    )
  )
)
[06/17 17:25:54 d2go.export.api]: Using model export method: <class 'd2go.export.torchscript.D2TorchscriptTracingExport'>
[06/17 17:25:54 d2go.export.torchscript]: Tracing and saving TorchScript to /content/drive/MyDrive/Detectron2 Data/d2go_fpn_600/output/torchscript_mobile_int8@tracing ...
/usr/local/lib/python3.7/dist-packages/detectron2/structures/image_list.py:92: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  assert t.shape[:-2] == tensors[0].shape[:-2], t.shape
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-13-5acf9d7ee1da> in <module>()
----> 1 predictor_path = export_predictor_int8(final_cfg, "/content/drive/MyDrive/Detectron2 Data/d2go_fpn_600/output", runner)

25 frames
/usr/local/lib/python3.7/dist-packages/detectron2/layers/wrappers.py in forward(self, x)
     83 
     84         x = F.conv2d(
---> 85             x, self.weight, self.bias, self.stride, self.padding, self.dilation, self.groups
     86         )
     87         if self.norm is not None:

RuntimeError: Could not run 'aten::thnn_conv2d_forward' with arguments from the 'QuantizedCPU' backend. This could be because the operator doesn't exist for this backend, or was omitted during the selective/custom build process (if using custom build). If you are a Facebook employee using PyTorch on mobile, please visit https://fburl.com/ptmfixes for possible resolutions. 'aten::thnn_conv2d_forward' is only available for these backends: [CPU, CUDA, BackendSelect, Named, AutogradOther, AutogradCPU, AutogradCUDA, AutogradXLA, AutogradNestedTensor, UNKNOWN_TENSOR_TYPE_ID, AutogradPrivateUse1, AutogradPrivateUse2, AutogradPrivateUse3, Tracer, Autocast, Batched, VmapMode].

CPU: registered at /pytorch/build/aten/src/ATen/RegisterCPU.cpp:5925 [kernel]
CUDA: registered at /pytorch/build/aten/src/ATen/RegisterCUDA.cpp:7100 [kernel]
BackendSelect: fallthrough registered at /pytorch/aten/src/ATen/core/BackendSelectFallbackKernel.cpp:3 [backend fallback]
Named: registered at /pytorch/aten/src/ATen/core/NamedRegistrations.cpp:7 [backend fallback]
AutogradOther: registered at /pytorch/torch/csrc/autograd/generated/VariableType_0.cpp:9273 [autograd kernel]
AutogradCPU: registered at /pytorch/torch/csrc/autograd/generated/VariableType_0.cpp:9273 [autograd kernel]
AutogradCUDA: registered at /pytorch/torch/csrc/autograd/generated/VariableType_0.cpp:9273 [autograd kernel]
AutogradXLA: registered at /pytorch/torch/csrc/autograd/generated/VariableType_0.cpp:9273 [autograd kernel]
AutogradNestedTensor: registered at /pytorch/torch/csrc/autograd/generated/VariableType_0.cpp:9273 [autograd kernel]
UNKNOWN_TENSOR_TYPE_ID: registered at /pytorch/torch/csrc/autograd/generated/VariableType_0.cpp:9273 [autograd kernel]
AutogradPrivateUse1: registered at /pytorch/torch/csrc/autograd/generated/VariableType_0.cpp:9273 [autograd kernel]
AutogradPrivateUse2: registered at /pytorch/torch/csrc/autograd/generated/VariableType_0.cpp:9273 [autograd kernel]
AutogradPrivateUse3: registered at /pytorch/torch/csrc/autograd/generated/VariableType_0.cpp:9273 [autograd kernel]
Tracer: registered at /pytorch/torch/csrc/autograd/generated/TraceType_0.cpp:10499 [kernel]
Autocast: fallthrough registered at /pytorch/aten/src/ATen/autocast_mode.cpp:250 [backend fallback]
Batched: registered at /pytorch/aten/src/ATen/BatchingRegistrations.cpp:1016 [backend fallback]
VmapMode: fallthrough registered at /pytorch/aten/src/ATen/VmapModeRegistrations.cpp:33 [backend fallback]

KeyError: 'Non-existent config key: EXPORT_CAFFE2'

Hi !
I am trying to train custom keypoint model on D2go . While setting config file parameter cfg.merge_from_file(model_zoo.get_config_file("keypoint_rcnn_fbnetv3a_dsmask_C4.yaml"))
I am getting error : KeyError: 'Non-existent config key: EXPORT_CAFFE2' .Seems like this is a bug

AttributeError: RCNN_PREPARE_FOR_QUANT

Instructions To Reproduce the ๐Ÿ› Bug:

  1. Full runnable code or full changes you made:
import copy
from detectron2.data import build_detection_test_loader
from d2go.export.api import convert_and_export_predictor
from d2go.export.d2_meta_arch import patch_d2_meta_arch

import logging

# disable all the warnings
previous_level = logging.root.manager.disable
logging.disable(logging.INFO)

patch_d2_meta_arch()

pytorch_model = runner.build_model(cfg, eval_only=True)
pytorch_model.cpu()

datasets = cfg.DATASETS.TRAIN[0]
data_loader = runner.build_detection_test_loader(cfg, datasets)

predictor_path = convert_and_export_predictor(
  copy.deepcopy(cfg),
  copy.deepcopy(pytorch_model),
  "torchscript_int8@tracing",
  './',
  data_loader
)

# recover the logging level
logging.disable(previous_level)
  1. Full logs or other relevant observations:
Arguments ['width_divisor', 'dw_skip_bnrelu', 'zero_last_bn_gamma'] skipped for op Conv2d
Skip loading parameter 'roi_heads.box_predictor.cls_score.weight' to the model due to incompatible shapes: (81, 288) in the checkpoint but (2, 288) in the model! You might want to double check if this is expected.
Skip loading parameter 'roi_heads.box_predictor.cls_score.bias' to the model due to incompatible shapes: (81,) in the checkpoint but (2,) in the model! You might want to double check if this is expected.
Skip loading parameter 'roi_heads.box_predictor.bbox_pred.weight' to the model due to incompatible shapes: (320, 288) in the checkpoint but (4, 288) in the model! You might want to double check if this is expected.
Skip loading parameter 'roi_heads.box_predictor.bbox_pred.bias' to the model due to incompatible shapes: (320,) in the checkpoint but (4,) in the model! You might want to double check if this is expected.
Skip loading parameter 'roi_heads.mask_head.predictor.weight' to the model due to incompatible shapes: (80, 256, 1, 1) in the checkpoint but (1, 256, 1, 1) in the model! You might want to double check if this is expected.
Skip loading parameter 'roi_heads.mask_head.predictor.bias' to the model due to incompatible shapes: (80,) in the checkpoint but (1,) in the model! You might want to double check if this is expected.
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-43-2ce4be1677cb> in <module>()
     23   "torchscript_int8@tracing",
     24   './',
---> 25   data_loader
     26 )
     27 

4 frames
/usr/local/lib/python3.7/dist-packages/yacs/config.py in __getattr__(self, name)
    139             return self[name]
    140         else:
--> 141             raise AttributeError(name)
    142 
    143     def __setattr__(self, name, value):

AttributeError: RCNN_PREPARE_FOR_QUANT

Expected behavior:

I used the runner to train a model based on the "mask_rcnn_fbnetv3g_fpn.yaml" config from the d2go model zoo but everytime I try to convert and quantize the model I get this error.

how to set mutil gpu train?


๐Ÿš€ Feature

A clear and concise description of the feature proposal.

Motivation & Examples

Tell us why the feature is useful.

Describe what the feature would look like, if it is implemented.
Best demonstrated using code examples in addition to words.

modules moved in demo.py

Instructions To Reproduce the ๐Ÿ› Bug:

  1. Full runnable code or full changes you made:
If making changes to the project itself, please use output of the following command:
git rev-parse HEAD; git diff

<put code or diff here>
  1. What exact command you run:
  2. Full logs or other relevant observations:
<put logs here>
  1. please simplify the steps as much as possible so they do not require additional resources to run, such as a private dataset.

Expected behavior:

If there are no obvious error in "what you observed" provided above,
please tell us the expected behavior.

Build semantic model with fbnet backbone

related to : #79

It would be nice to have a config that builds a semantic model with a fbnet backbone.

However, i'm not sure how to put the trunks and res's in in features and out features to make it work.

Register FBNet backbone in detectron2

I assume there must be a way to register the backbone when trying to call a d2go model from detectron2 e.g trainer = Trainer(cfg)
where the cfg is "mask_rcnn_fbnetv3g_fpn.yaml". However, i get a

KeyError: "No object named 'FBNetV2FpnBackbone' found in 'BACKBONE' registry!"
I am not sure what i need to import from d2go in order to make this work.

Also, it seems like your backbone is v2, but you use v3 everywhere else.

Per channel weight observer is not supported yet for ConvTranspose{n}d

I've trained a custom Mask RCNN model and I'm trying to export that to Torchscript. I have 'model_final.pth' file.
This is the code I'm trying (I don't even know if this is true for custom training):

import copy
from detectron2.data import build_detection_test_loader
from d2go.export.api import convert_and_export_predictor
from d2go.utils.testing.data_loader_helper import create_fake_detection_data_loader
from d2go.export.d2_meta_arch import patch_d2_meta_arch

import logging

# disable all the warnings
previous_level = logging.root.manager.disable
logging.disable(logging.INFO)

patch_d2_meta_arch()

cfg_name = 'mask_rcnn_fbnetv3a_C4.yaml'
pytorch_model = model_zoo.get(cfg_name, trained=True)
pytorch_model.cpu()

with create_fake_detection_data_loader(224, 320, is_train=False) as data_loader:
    predictor_path = convert_and_export_predictor(
            model_zoo.get_config(cfg_name),
            copy.deepcopy(pytorch_model),
            "torchscript_int8@tracing",
            './',
            data_loader,
        )

# recover the logging level
logging.disable(previous_level)

The error I'm getting:

/usr/local/lib/python3.7/dist-packages/torch/quantization/qconfig.py in assert_valid_qconfig(qconfig, mod)
    126         )
    127         assert not is_per_channel, \
--> 128             'Per channel weight observer is not supported yet for ConvTranspose{n}d.'

AssertionError: Per channel weight observer is not supported yet for ConvTranspose{n}d.

Unable to replicate balloon training result

Code to reproduce result:

Tried to test the training of a model via the balloon example (https://github.com/facebookresearch/d2go/blob/master/demo/d2go_beginner.ipynb)

import os
import json
import numpy as np
from detectron2.structures import BoxMode
from detectron2.data import MetadataCatalog, DatasetCatalog
import cv2

def get_balloon_dicts(img_dir):
    json_file = os.path.join(img_dir, "via_region_data.json")
    with open(json_file) as f:
        imgs_anns = json.load(f)

    dataset_dicts = []
    for idx, v in enumerate(imgs_anns.values()):
        record = {}
        
        filename = os.path.join(img_dir, v["filename"])
        height, width = cv2.imread(filename).shape[:2]
        
        record["file_name"] = filename
        record["image_id"] = idx
        record["height"] = height
        record["width"] = width
      
        annos = v["regions"]
        objs = []
        for _, anno in annos.items():
            assert not anno["region_attributes"]
            anno = anno["shape_attributes"]
            px = anno["all_points_x"]
            py = anno["all_points_y"]
            poly = [(x + 0.5, y + 0.5) for x, y in zip(px, py)]
            poly = [p for x in poly for p in x]

            obj = {
                "bbox": [np.min(px), np.min(py), np.max(px), np.max(py)],
                "bbox_mode": BoxMode.XYXY_ABS,
                "segmentation": [poly],
                "category_id": 0,
            }
            objs.append(obj)
        record["annotations"] = objs
        dataset_dicts.append(record)
    return dataset_dicts

for d in ["train", "val"]:
    DatasetCatalog.register("balloon_" + d, lambda d=d: get_balloon_dicts("balloon/" + d))
    MetadataCatalog.get("balloon_" + d).set(thing_classes=["balloon"], evaluator_type="coco")

balloon_metadata = MetadataCatalog.get("balloon_train")

from d2go.runner import Detectron2GoRunner
from d2go.model_zoo import model_zoo

def prepare_for_launch():
    runner = Detectron2GoRunner()
    cfg = runner.get_default_cfg()
    cfg.merge_from_file(model_zoo.get_config_file("faster_rcnn_fbnetv3a_C4.yaml"))
    cfg.MODEL_EMA.ENABLED = False
    cfg.DATASETS.TRAIN = ("balloon_train",)
    cfg.DATASETS.TEST = ("balloon_val",)
    cfg.DATALOADER.NUM_WORKERS = 2
    cfg.MODEL.WEIGHTS = model_zoo.get_checkpoint_url("faster_rcnn_fbnetv3a_C4.yaml")  # Let training initialize from model zoo
    cfg.SOLVER.IMS_PER_BATCH = 2
    cfg.SOLVER.BASE_LR = 0.00025  # pick a good LR
    cfg.SOLVER.MAX_ITER = 600    # 600 iterations seems good enough for this toy dataset; you will need to train longer for a practical dataset
    cfg.SOLVER.STEPS = []        # do not decay learning rate
    cfg.MODEL.ROI_HEADS.BATCH_SIZE_PER_IMAGE = 128   # faster, and good enough for this toy dataset (default: 512)
    cfg.MODEL.ROI_HEADS.NUM_CLASSES = 1  # only has one class (ballon). (see https://detectron2.readthedocs.io/tutorials/datasets.html#update-the-config-for-new-datasets)
    cfg.OUTPUT_DIR = 'balloon_model'
    # NOTE: this config means the number of classes, but a few popular unofficial tutorials incorrect uses num_classes+1 here.
    os.makedirs(cfg.OUTPUT_DIR, exist_ok=True)
    return cfg, runner

cfg, runner = prepare_for_launch()
model = runner.build_model(cfg)
runner.do_train(cfg, model, resume=False)

cfg.MODEL.WEIGHTS = 'balloon_model/model_final.pth'
metrics = runner.do_test(cfg, model)
print(metrics)

Result

 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.021
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.061
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.012
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.000
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.001
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.041
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.004
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.118
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.204
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.000
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.012
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.333

And the inference results on test images are terrible.

Expected Result

 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.494
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.651
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.543
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.000
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.104
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.757
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.204
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.526
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.526
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.000
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.118
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.810

AttributeError: 'GeneralizedRCNNRunner' object has no attribute 'from_config' and ModuleNotFoundError: No module named 'd2go.runner.callbacks

Hi, Thanks for this cool project.

I went to through the notebook provided in the demo folder and was able to execute with no error. I am actually more interested to train the same balloon dataset with the Pytorch lightning enabled script lightning_train_net.py provided in the tools but faced few errors as below

  1. ModuleNotFoundError: No module named 'd2go.runner.callbacks, though everything is inlined.
  2. AttributeError: 'GeneralizedRCNNRunner' object has no attribute 'from_config

As QuantizationAwareTraining was optional so I disabled it in the main function as below

cfg = build_config(args.config_file, task_cls, opts=["QUANTIZATION.QAT.ENABLED",False,"DATASETS.TRAIN" ,("balloon_train",), "DATASETS.TEST",("balloon_val",),"MODEL.DEVICE","cpu"])

but the object has no attribute 'from_config error still occurs, I have printed the attributes of GeneralizedRCNNRunner and as I expected from_config attribute is not present. Though the strange thing is that I am able to call from_config methods in lightning_task.py in the runner module from where we are importing GeneralizedRCNNRunner object in lightning_train_net.py

image

image

1.I have not made any changes in the lightning_train_net.py just override few config parameters as you can see below
image
and use python lightning_train_net.py --config-file /home/arvind/d2go/configs/faster_rcnn_fbnetv3a_C4.yaml to run the training

  1. Full logs or other relevant observations:
(D2GO) arvind@arvind-ThinkPad-P14s-Gen-1:~/d2go/tools$ python lightning_train_net.py --config-file /home/arvind/d2go/configs/faster_rcnn_fbnetv3a_C4.yaml 
[INFO] Attributes for  GeneralizedRCNNTask ...  ['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_create_after_step_hook', '_create_qat_hook', '_do_test', '_initialize', 'build_caffe2_model', 'build_checkpointer', 'build_detection_test_loader', 'build_detection_train_loader', 'build_lr_scheduler', 'build_model', 'build_optimizer', 'build_traceable_model', 'do_test', 'do_train', 'final_model_name', 'get_data_loader_vis_wrapper', 'get_default_cfg', 'get_evaluator', 'get_mapper', 'get_visualization_evaluator', 'register']
ABNORMAL_CHECKER:
  ENABLED: False
CUDNN_BENCHMARK: False
D2GO_DATA:
  AUG_OPS:
    TEST: ['ResizeShortestEdgeOp']
    TRAIN: ['ResizeShortestEdgeOp', 'RandomFlipOp']
  DATASETS:
    COCO_INJECTION:
      IM_DIRS: []
      JSON_FILES: []
      NAMES: []
    DYNAMIC_DATASETS: []
    TEST_CATEGORIES: ()
    TRAIN_CATEGORIES: ()
  MAPPER:
    BACKFILL_SIZE: False
    CATCH_EXCEPTION: True
    NAME: D2GoDatasetMapper
    RETRY: 3
  TEST:
    MAX_IMAGES: 0
    SUBSET_SAMPLING: frontmost
DATALOADER:
  ASPECT_RATIO_GROUPING: True
  FILTER_EMPTY_ANNOTATIONS: True
  NUM_WORKERS: 4
  REPEAT_THRESHOLD: 0.0
  SAMPLER_TRAIN: TrainingSampler
DATASETS:
  PRECOMPUTED_PROPOSAL_TOPK_TEST: 1000
  PRECOMPUTED_PROPOSAL_TOPK_TRAIN: 2000
  PROPOSAL_FILES_TEST: ()
  PROPOSAL_FILES_TRAIN: ()
  TEST: ('balloon_val',)
  TRAIN: ('balloon_train',)
  TRAIN_REPEAT_FACTOR: []
EXPORT_CAFFE2:
  USE_HEATMAP_MAX_KEYPOINT: False
GLOBAL:
  HACK: 1.0
INPUT:
  CROP:
    ENABLED: False
    SIZE: [0.9, 0.9]
    TYPE: relative_range
  FORMAT: BGR
  MASK_FORMAT: polygon
  MAX_SIZE_TEST: 320
  MAX_SIZE_TRAIN: 320
  MIN_SIZE_TEST: 224
  MIN_SIZE_TRAIN: (224,)
  MIN_SIZE_TRAIN_SAMPLING: choice
  RANDOM_FLIP: horizontal
MODEL:
  ANCHOR_GENERATOR:
    ANGLES: [[-90, 0, 90]]
    ASPECT_RATIOS: [[0.5, 1.0, 2.0]]
    NAME: DefaultAnchorGenerator
    OFFSET: 0.0
    SIZES: [[32, 64, 96, 128, 160]]
  BACKBONE:
    FREEZE_AT: 2
    NAME: FBNetV2C4Backbone
  DDP_FIND_UNUSED_PARAMETERS: False
  DEVICE: cpu
  FBNET_V2:
    ARCH: FBNetV3_A
    ARCH_DEF: []
    NORM: naiveSyncBN
    NORM_ARGS: []
    SCALE_FACTOR: 1.0
    STEM_IN_CHANNELS: 3
    WIDTH_DIVISOR: 8
  FPN:
    FUSE_TYPE: sum
    IN_FEATURES: []
    NORM: 
    OUT_CHANNELS: 256
  FROZEN_LAYER_REG_EXP: []
  KEYPOINT_ON: False
  KMEANS_ANCHORS:
    DATASETS: ()
    KMEANS_ANCHORS_ON: False
    NUM_CLUSTERS: 0
    NUM_TRAINING_IMG: 0
    RNG_SEED: 3
  LOAD_PROPOSALS: False
  MASK_ON: False
  META_ARCHITECTURE: GeneralizedRCNN
  PANOPTIC_FPN:
    COMBINE:
      ENABLED: True
      INSTANCES_CONFIDENCE_THRESH: 0.5
      OVERLAP_THRESH: 0.5
      STUFF_AREA_LIMIT: 4096
    INSTANCE_LOSS_WEIGHT: 1.0
  PIXEL_MEAN: [103.53, 116.28, 123.675]
  PIXEL_STD: [1.0, 1.0, 1.0]
  PROPOSAL_GENERATOR:
    MIN_SIZE: 0
    NAME: RPN
  RESNETS:
    DEFORM_MODULATED: False
    DEFORM_NUM_GROUPS: 1
    DEFORM_ON_PER_STAGE: [False, False, False, False]
    DEPTH: 50
    NORM: FrozenBN
    NUM_GROUPS: 1
    OUT_FEATURES: ['res4']
    RES2_OUT_CHANNELS: 256
    RES5_DILATION: 1
    STEM_OUT_CHANNELS: 64
    STRIDE_IN_1X1: True
    WIDTH_PER_GROUP: 64
  RETINANET:
    BBOX_REG_LOSS_TYPE: smooth_l1
    BBOX_REG_WEIGHTS: (1.0, 1.0, 1.0, 1.0)
    FOCAL_LOSS_ALPHA: 0.25
    FOCAL_LOSS_GAMMA: 2.0
    IN_FEATURES: ['p3', 'p4', 'p5', 'p6', 'p7']
    IOU_LABELS: [0, -1, 1]
    IOU_THRESHOLDS: [0.4, 0.5]
    NMS_THRESH_TEST: 0.5
    NORM: 
    NUM_CLASSES: 80
    NUM_CONVS: 4
    PRIOR_PROB: 0.01
    SCORE_THRESH_TEST: 0.05
    SMOOTH_L1_LOSS_BETA: 0.1
    TOPK_CANDIDATES_TEST: 1000
  ROI_BOX_CASCADE_HEAD:
    BBOX_REG_WEIGHTS: ((10.0, 10.0, 5.0, 5.0), (20.0, 20.0, 10.0, 10.0), (30.0, 30.0, 15.0, 15.0))
    IOUS: (0.5, 0.6, 0.7)
  ROI_BOX_HEAD:
    BBOX_REG_LOSS_TYPE: smooth_l1
    BBOX_REG_LOSS_WEIGHT: 1.0
    BBOX_REG_WEIGHTS: (10.0, 10.0, 5.0, 5.0)
    CLS_AGNOSTIC_BBOX_REG: False
    CONV_DIM: 256
    FC_DIM: 1024
    NAME: FBNetV2RoIBoxHead
    NORM: naiveSyncBN
    NUM_CONV: 0
    NUM_FC: 0
    POOLER_RESOLUTION: 6
    POOLER_SAMPLING_RATIO: 0
    POOLER_TYPE: ROIAlignV2
    SMOOTH_L1_BETA: 0.0
    TRAIN_ON_PRED_BOXES: False
  ROI_HEADS:
    BATCH_SIZE_PER_IMAGE: 512
    IN_FEATURES: ['trunk3']
    IOU_LABELS: [0, 1]
    IOU_THRESHOLDS: [0.5]
    NAME: StandardROIHeads
    NMS_THRESH_TEST: 0.5
    NUM_CLASSES: 80
    POSITIVE_FRACTION: 0.25
    PROPOSAL_APPEND_GT: True
    SCORE_THRESH_TEST: 0.05
  ROI_KEYPOINT_HEAD:
    CONV_DIMS: (512, 512, 512, 512, 512, 512, 512, 512)
    LOSS_WEIGHT: 1.0
    MIN_KEYPOINTS_PER_IMAGE: 1
    NAME: KRCNNConvDeconvUpsampleHead
    NORMALIZE_LOSS_BY_VISIBLE_KEYPOINTS: True
    NUM_KEYPOINTS: 17
    POOLER_RESOLUTION: 14
    POOLER_SAMPLING_RATIO: 0
    POOLER_TYPE: ROIAlignV2
  ROI_MASK_HEAD:
    CLS_AGNOSTIC_MASK: False
    CONV_DIM: 256
    NAME: MaskRCNNConvUpsampleHead
    NORM: 
    NUM_CONV: 4
    POOLER_RESOLUTION: 14
    POOLER_SAMPLING_RATIO: 0
    POOLER_TYPE: ROIAlignV2
  RPN:
    BATCH_SIZE_PER_IMAGE: 256
    BBOX_REG_LOSS_TYPE: smooth_l1
    BBOX_REG_LOSS_WEIGHT: 1.0
    BBOX_REG_WEIGHTS: (1.0, 1.0, 1.0, 1.0)
    BOUNDARY_THRESH: -1
    CONV_DIMS: [-1]
    HEAD_NAME: FBNetV2RpnHead
    IN_FEATURES: ['trunk3']
    IOU_LABELS: [0, -1, 1]
    IOU_THRESHOLDS: [0.3, 0.7]
    LOSS_WEIGHT: 1.0
    NMS_THRESH: 0.7
    POSITIVE_FRACTION: 0.5
    POST_NMS_TOPK_TEST: 30
    POST_NMS_TOPK_TRAIN: 2000
    PRE_NMS_TOPK_TEST: 1000
    PRE_NMS_TOPK_TRAIN: 2000
    SMOOTH_L1_BETA: 0.0
  SEM_SEG_HEAD:
    COMMON_STRIDE: 4
    CONVS_DIM: 128
    IGNORE_VALUE: 255
    IN_FEATURES: ['p2', 'p3', 'p4', 'p5']
    LOSS_WEIGHT: 1.0
    NAME: SemSegFPNHead
    NORM: GN
    NUM_CLASSES: 54
  SUBCLASS:
    NUM_LAYERS: 1
    NUM_SUBCLASSES: 0
    SUBCLASS_ID_FETCHER: SubclassFetcher
    SUBCLASS_MAPPING: []
    SUBCLASS_ON: False
  VT_FPN:
    HEADS: 16
    IN_FEATURES: ['res2', 'res3', 'res4', 'res5']
    LAYERS: 3
    MIN_GROUP_PLANES: 64
    NORM: BN
    OUT_CHANNELS: 256
    POS_HWS: []
    POS_N_DOWNSAMPLE: []
    TOKEN_C: 1024
    TOKEN_LS: [16, 16, 8, 8]
  WEIGHTS: 
MODEL_EMA:
  DECAY: 0.9998
  DEVICE: 
  ENABLED: True
  USE_EMA_WEIGHTS_FOR_EVAL_ONLY: False
OUTPUT_DIR: ./output
QUANTIZATION:
  BACKEND: fbgemm
  CUSTOM_QSCHEME: 
  EAGER_MODE: True
  PTQ:
    CALIBRATION_FORCE_ON_GPU: False
    CALIBRATION_NUM_IMAGES: 1
  QAT:
    BATCH_SIZE_FACTOR: 1.0
    DISABLE_OBSERVER_ITER: 38000
    ENABLED: False
    ENABLE_OBSERVER_ITER: 35000
    FREEZE_BN_ITER: 37000
    START_ITER: 35000
    UPDATE_OBSERVER_STATS_PERIOD: 1
    UPDATE_OBSERVER_STATS_PERIODICALLY: False
  SILICON_QAT:
    ENABLED: False
SEED: -1
SOLVER:
  AMP:
    ENABLED: False
  AUTO_SCALING_METHODS: ['default_scale_d2_configs', 'default_scale_quantization_configs']
  BASE_LR: 0.16
  BIAS_LR_FACTOR: 1.0
  CHECKPOINT_PERIOD: 5000
  CLIP_GRADIENTS:
    CLIP_TYPE: value
    CLIP_VALUE: 1.0
    ENABLED: False
    NORM_TYPE: 2.0
  GAMMA: 0.1
  IMS_PER_BATCH: 32
  LR_MULTIPLIER_OVERWRITE: []
  LR_SCHEDULER_NAME: WarmupCosineLR
  MAX_ITER: 540000
  MOMENTUM: 0.9
  NESTEROV: False
  OPTIMIZER: sgd
  REFERENCE_WORLD_SIZE: 8
  STEPS: (60000, 80000)
  WARMUP_FACTOR: 0.001
  WARMUP_ITERS: 1000
  WARMUP_METHOD: linear
  WEIGHT_DECAY: 0.0001
  WEIGHT_DECAY_BIAS: 0.0001
  WEIGHT_DECAY_NORM: 0.0
TENSORBOARD:
  TEST_VIS_MAX_IMAGES: 16
  TRAIN_LOADER_VIS_MAX_IMAGES: 16
  TRAIN_LOADER_VIS_WRITE_PERIOD: 20
TEST:
  AUG:
    ENABLED: False
    FLIP: True
    MAX_SIZE: 4000
    MIN_SIZES: (400, 500, 600, 700, 800, 900, 1000, 1100, 1200)
  DETECTIONS_PER_IMAGE: 100
  EVAL_PERIOD: 10000
  EXPECTED_RESULTS: []
  KEYPOINT_OKS_SIGMAS: []
  PRECISE_BN:
    ENABLED: False
    NUM_ITER: 200
VERSION: 2
VIS_PERIOD: 0
[INFO] we are reached here......
Traceback (most recent call last):
  File "lightning_train_net.py", line 261, in <module>
    ret = main(
  File "lightning_train_net.py", line 185, in main
    task = task_cls.from_config(cfg, eval_only)
AttributeError: 'GeneralizedRCNNRunner' object has no attribute 'from_config'

# # Expected behavior:
**I have followed the exact steps mentioned in the repo to build d2go.  I wish I can train the model using PTL, Please let me know if any other information needed. It would be a great help if you guys tell me what I am missing?**

Thanks 
Best Regards
Arvind


cannot load exported torchscript model with pytorch_mobile (in flutter)

1-I exported "faster_rcnn_fbnetv3a_dsmask_C4" model with the code provided here : https://github.com/pytorch/android-demo-app/blob/master/D2Go/create_d2go.py
with torch==1.8.0 torchvision==0.9.0 torchaudio=0.8.0.
So finally got "d2go.pt" file.

  1. Then in flutter I tried to load d2go.pt model with package pytorch_mobile. But when I reach the line
    PyTorchMobile.loadModel('assets/models/d2go.pt');
    I get the following errors in my Log:

E/PyTorchMobile(17944): assets/models/d2go.pt is not a proper model
E/PyTorchMobile(17944): com.facebook.jni.CppException:
E/PyTorchMobile(17944): Unknown builtin op: torchvision::nms.
E/PyTorchMobile(17944): Could not find any similar ops to torchvision::nms. This op may not exist or may not be currently supported in TorchScript.
E/PyTorchMobile(17944): :
E/PyTorchMobile(17944): File "/content/drive/MyDrive/detection/env/lib/python3.7/site-packages/torchvision/ops/boxes.py", line 36
E/PyTorchMobile(17944): """
E/PyTorchMobile(17944): _assert_has_ops()
E/PyTorchMobile(17944): return torch.ops.torchvision.nms(boxes, scores, iou_threshold)
E/PyTorchMobile(17944): ~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
E/PyTorchMobile(17944): Serialized File "code/torch/torchvision/ops/boxes.py", line 26
E/PyTorchMobile(17944): _8 = torch.torchvision.extension._assert_has_ops
E/PyTorchMobile(17944): _9 = _8()
E/PyTorchMobile(17944): _10 = ops.torchvision.nms(boxes, scores, iou_threshold)
E/PyTorchMobile(17944): ~~~~~~~~~~~~~~~~~~~ <--- HERE
E/PyTorchMobile(17944): return _10
E/PyTorchMobile(17944):
E/PyTorchMobile(17944): at org.pytorch.NativePeer.initHybrid(Native Method)
E/PyTorchMobile(17944): at org.pytorch.NativePeer.(NativePeer.java:24)
E/PyTorchMobile(17944): at org.pytorch.Module.load(Module.java:23)
E/PyTorchMobile(17944): at io.fynn.pytorch_mobile.PyTorchMobilePlugin.onMethodCall(PyTorchMobilePlugin.java:46)
E/PyTorchMobile(17944): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/PyTorchMobile(17944): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/PyTorchMobile(17944): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818)
E/PyTorchMobile(17944): at android.os.MessageQueue.nativePollOnce(Native Method)
E/PyTorchMobile(17944): at android.os.MessageQueue.next(MessageQueue.java:325)
E/PyTorchMobile(17944): at android.os.Looper.loop(Looper.java:142)
E/PyTorchMobile(17944): at android.app.ActivityThread.main(ActivityThread.java:6944)
E/PyTorchMobile(17944): at java.lang.reflect.Method.invoke(Native Method)
E/PyTorchMobile(17944): at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
E/PyTorchMobile(17944): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

Expected behavior:

loading the model.

Is there anyone who knows what is happening?!

assertion error in data loader while converting to int8

I trained "faster_rcnn_fbnetv3g_fpn" on custom dataset. And model trained successfully. but receiving this error while converting to int8.

code I am using to convert:

import copy
from detectron2.data import build_detection_test_loader
from d2go.export.api import convert_and_export_predictor
from d2go.tests.data_loader_helper import create_fake_detection_data_loader
from d2go.export.d2_meta_arch import patch_d2_meta_arch

import logging

# disable all the warnings
previous_level = logging.root.manager.disable
logging.disable(logging.INFO)

patch_d2_meta_arch()

cfg_name = 'faster_rcnn_fbnetv3g_fpn.yaml'
pytorch_model = model_zoo.get(cfg_name, trained=True)
pytorch_model.cpu()

with create_fake_detection_data_loader(224, 320, is_train=False) as data_loader:
    predictor_path = convert_and_export_predictor(
            model_zoo.get_config(cfg_name),
            copy.deepcopy(pytorch_model),
            "torchscript_int8@tracing",
            './',
            data_loader,
        )

# recover the logging level
logging.disable(previous_level)

The error I am receiving:

WARNING [03/16 06:34:40 mobile_cv.arch.utils.helper]: Arguments ['width_divisor', 'dw_skip_bnrelu', 'zero_last_bn_gamma'] skipped for op Conv2d
loading annotations into memory...
Done (t=0.00s)
creating index...
index created!
/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py:477: UserWarning: This DataLoader will create 4 worker processes in total. Our suggested max number of worker in current system is 2, which is smaller than what this DataLoader is going to create. Please be aware that excessive worker creation might get DataLoader running slow or even freeze, lower the worker number to avoid potential slowness/freeze if necessary.
  cpuset_checked))
/usr/local/lib/python3.7/dist-packages/torch/quantization/observer.py:123: UserWarning: Please use quant_min and quant_max to specify the range for observers.                     reduce_range will be deprecated in a future release of PyTorch.
  reduce_range will be deprecated in a future release of PyTorch."
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-19-46e25055929a> in <module>()
     23             "torchscript_int8@tracing",
     24             './',
---> 25             data_loader,
     26         )
     27 

/usr/local/lib/python3.7/dist-packages/d2go/export/api.py in convert_and_export_predictor(cfg, pytorch_model, predictor_type, output_dir, data_loader)
     98             pytorch_model = post_training_quantize(cfg, pytorch_model, data_loader)
     99             # only check bn exists in ptq as qat still has bn inside fused ops
--> 100             assert not fuse_utils.check_bn_exist(pytorch_model)
    101         logger.info(f"Converting quantized model {cfg.QUANTIZATION.BACKEND}...")
    102         if cfg.QUANTIZATION.EAGER_MODE:

AssertionError: 

I have changed the config file and included the newly registered custom dataset. what could be else wrong here?

exporting keypoint_rcnn_fbnetv3a_dsmask_C4 pretrained

Hello all

Could anyone ever export torchscript file for keypoint_rcnn_fbnetv3a_dsmask_C4 pre-trained model using create_d2go.py file?
I altered the Wrapper to return "keypoints" beside others ("boxes","scores","labels"). "Keypoints" are in the out[3] in Wrapper.
res["scores"] = out[2]

Here is the code I use to export the model is:
`
#!/usr/bin/env python3

import contextlib
import copy
import os
import unittest
from PIL import Image

import torch
from d2go.export.api import convert_and_export_predictor
from d2go.export.d2_meta_arch import patch_d2_meta_arch
from d2go.runner import create_runner, GeneralizedRCNNRunner
from d2go.model_zoo import model_zoo
from typing import List, Dict
from mobile_cv.common.misc.file_utils import make_temp_directory
from d2go.utils.testing.data_loader_helper import LocalImageGenerator, register_toy_dataset
from d2go.utils.testing.data_loader_helper import create_fake_detection_data_loader

patch_d2_meta_arch()




  cfg_name = 'keypoint_rcnn_fbnetv3a_dsmask_C4.yaml'
  pytorch_model = model_zoo.get(cfg_name, trained=True)
  # pytorch_model.training=False
  # pytorch_model.eval()

  class Wrapper(torch.nn.Module):

      def __init__(self, model):

          super().__init__()
          self.model = model
          coco_idx_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
                           27, 28, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 46, 47, 48, 49, 50, 51,
                           52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 67, 70, 72, 73, 74, 75, 76, 77,
                           78, 79, 80, 81, 82, 84, 85, 86, 87, 88, 89, 90, 91]

          self.coco_idx = torch.tensor(coco_idx_list)

      def forward(self, inputs: List[torch.Tensor]):
          x = inputs[0].unsqueeze(0) * 255
          scale = 320.0 / min(x.shape[-2], x.shape[-1])
          x = torch.nn.functional.interpolate(x, scale_factor=scale, mode="bilinear", align_corners=True, recompute_scale_factor=True)
          out = self.model(x[0])

          res=( out[3],
          out[0] / scale,
          torch.index_select(self.coco_idx, 0, out[1]),
          out[4],)

          return res

  size_divisibility = max(pytorch_model.backbone.size_divisibility, 10)

  h, w = size_divisibility, size_divisibility * 2
  with create_fake_detection_data_loader(h, w, is_train=False) as data_loader:
      predictor_path = convert_and_export_predictor(
          model_zoo.get_config(cfg_name),
          copy.deepcopy(pytorch_model),
          "torchscript_int8@tracing",
          './',
          data_loader,
      )

      orig_model = torch.jit.load(os.path.join(predictor_path, "model.jit"))
      wrapped_model = Wrapper(orig_model)
      # optionally do a forward
      import cv2
      im = cv2.imread("inp8.jpg",)
      im=torch.tensor(im)/255
      im=torch.reshape(im,(3,im.shape[0],im.shape[1]))
      
      wrapped_model([im])
      scripted_model = torch.jit.script(wrapped_model)
      scripted_model.save("d2go_tracker_temp.pt")

`
when I use exported .pt file in android I get corrupted keypoints coordinates and it seems it's due to the TracerWarnings meanwhile I export torchscript file ( Converting a tensor to other python types cause the value to be constant in the torchscript output file)

I am pretty sure the input format of the forwarding path in android is correct. The output of the model in android for keypoint_rcnn_fbnetv3a_dsmask_C4 model is "boxes","scores","labels","keypoints". but "keypoints" are not correct. others are fine and I can draw boxes around "persons".

my meaning of corrupted keypoints : for each keypoint the model in android returns the same (x,y,probability)
## Expected behavior:
get the same output as the time I run the model in python3 with DemoPredicator.

D2Go vs D2

Hi,

What are the preference usage cases of d2go over general detectron2 usage?
Say, detectron2 has training/evaluation/export functionality, while d2go just seems to wrap it. Yet it is made a whole separate library, so I'm curious what are its usage advantages that grounded decision for its development?

RuntimeError: keypoint_rcnn_fbnetv3a_dsmask_C4.yaml not available in Model Zoo!

Hi!

Here is the google colab https://colab.research.google.com/drive/1YYsH0ofAghS5W6PcZ5tBizCnLsJumuIe?usp=sharing . When I am trying to load the Zoo model

from d2go.model_zoo import model_zoo
cfg = model_zoo.get('keypoint_rcnn_fbnetv3a_dsmask_C4.yaml')

but it says : RuntimeError: keypoint_rcnn_fbnetv3a_dsmask_C4.yaml not available in Model Zoo!
I checked the model_zoo.py file and found that the above model exists. Could you please help me out

Inference on video

Hello ,
Using the google collab notebook, d2go beginner I was wondering, if there is a documentation to run the model on a video ?

Is there also a documentation on to know more about the raw output ? such as tensors keypoints_order and classes_id ??

Thanks

ModuleNotFoundError: No module named 'd2go.tools'

Hi, thanks for your great job. I installed the environment as ReadMe said. No erros during setting up environment. But when I executed the example, I came across an ERROR:

~/d2go$ d2go.train_net --config-file ./configs/faster_rcnn_fbnetv3a_C4.yaml
Traceback (most recent call last):
  File "/home/lbc/anaconda3/envs/d2go/bin/d2go.train_net", line 5, in <module>
    from d2go.tools.train_net import cli
ModuleNotFoundError: No module named 'd2go.tools'

But in python interpreter environment, it's fine to import d2go.tools in current directory. It will report the same error in the up-level dir.

~/d2go$ python
Python 3.6.13 |Anaconda, Inc.| (default, Feb 23 2021, 21:15:04)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from d2go.tools.train_net import cli
** fvcore version of PathManager will be deprecated soon. **
** Please migrate to the version in iopath repo. **
https://github.com/facebookresearch/iopath

>>>

install fail

(detectron2) chenxin@Nitro-AN515:/Downloads$ python -m pip install -e detectron2
Obtaining file:///home/chenxin/Downloads/detectron2
Collecting termcolor>=1.1
Downloading termcolor-1.1.0.tar.gz (3.9 kB)
Requirement already satisfied: Pillow>=7.1 in /home/chenxin/.local/lib/python3.6/site-packages/Pillow-8.1.0-py3.6-linux-x86_64.egg (from detectron2==0.4) (8.1.0)
Collecting yacs>=0.1.6
Downloading yacs-0.1.8-py3-none-any.whl (14 kB)
Collecting tabulate
Downloading tabulate-0.8.9-py3-none-any.whl (25 kB)
Collecting cloudpickle
Downloading cloudpickle-1.6.0-py3-none-any.whl (23 kB)
Requirement already satisfied: matplotlib in /home/chenxin/.local/lib/python3.6/site-packages (from detectron2==0.4) (3.3.2)
Requirement already satisfied: tqdm>4.29.0 in /home/chenxin/.local/lib/python3.6/site-packages (from detectron2==0.4) (4.31.1)
Collecting tensorboard
Downloading tensorboard-2.4.1-py3-none-any.whl (10.6 MB)
|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 10.6 MB 237 kB/s
Collecting fvcore<0.1.4,>=0.1.3
Downloading fvcore-0.1.3.post20210311.tar.gz (47 kB)
|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 47 kB 110 kB/s
Collecting iopath>=0.1.2
Downloading iopath-0.1.6.tar.gz (16 kB)
Collecting pycocotools>=2.0.2
Downloading pycocotools-2.0.2.tar.gz (23 kB)
Collecting future
Downloading future-0.18.2.tar.gz (829 kB)
|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 829 kB 804 kB/s
Collecting pydot
Downloading pydot-1.4.2-py2.py3-none-any.whl (21 kB)
Collecting omegaconf>=2
Downloading omegaconf-2.0.6-py3-none-any.whl (36 kB)
Requirement already satisfied: dataclasses in /home/chenxin/anaconda/envs/detectron2/lib/python3.6/site-packages (from detectron2==0.4) (0.8)
Requirement already satisfied: numpy in /home/chenxin/.local/lib/python3.6/site-packages (from fvcore<0.1.4,>=0.1.3->detectron2==0.4) (1.17.3)
Collecting pyyaml>=5.1
Downloading PyYAML-5.4.1-cp36-cp36m-manylinux1_x86_64.whl (640 kB)
|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 640 kB 202 kB/s
Collecting portalocker
Downloading portalocker-2.2.1-py2.py3-none-any.whl (15 kB)
Requirement already satisfied: typing-extensions in /home/chenxin/.local/lib/python3.6/site-packages (from omegaconf>=2->detectron2==0.4) (3.7.4.2)
Requirement already satisfied: setuptools>=18.0 in /home/chenxin/.local/lib/python3.6/site-packages (from pycocotools>=2.0.2->detectron2==0.4) (47.1.1)
Requirement already satisfied: cython>=0.27.3 in /home/chenxin/.local/lib/python3.6/site-packages (from pycocotools>=2.0.2->detectron2==0.4) (0.29.21)
Requirement already satisfied: kiwisolver>=1.0.1 in /home/chenxin/.local/lib/python3.6/site-packages/kiwisolver-1.1.0-py3.6-linux-x86_64.egg (from matplotlib->detectron2==0.4) (1.1.0)
Requirement already satisfied: certifi>=2020.06.20 in /home/chenxin/anaconda/envs/detectron2/lib/python3.6/site-packages (from matplotlib->detectron2==0.4) (2020.12.5)
Requirement already satisfied: python-dateutil>=2.1 in /home/chenxin/.local/lib/python3.6/site-packages/python_dateutil-2.8.0-py3.6.egg (from matplotlib->detectron2==0.4) (2.8.0)
Requirement already satisfied: cycler>=0.10 in /home/chenxin/.local/lib/python3.6/site-packages/cycler-0.10.0-py3.6.egg (from matplotlib->detectron2==0.4) (0.10.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3 in /home/chenxin/.local/lib/python3.6/site-packages/pyparsing-2.4.2-py3.6.egg (from matplotlib->detectron2==0.4) (2.4.2)
Requirement already satisfied: six in /home/chenxin/.local/lib/python3.6/site-packages (from cycler>=0.10->matplotlib->detectron2==0.4) (1.15.0)
Collecting grpcio>=1.24.3
Downloading grpcio-1.36.1-cp36-cp36m-manylinux2014_x86_64.whl (4.1 MB)
|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 4.1 MB 53 kB/s
Requirement already satisfied: wheel>=0.26 in /home/chenxin/anaconda/envs/detectron2/lib/python3.6/site-packages (from tensorboard->detectron2==0.4) (0.36.2)
Collecting tensorboard-plugin-wit>=1.6.0
Downloading tensorboard_plugin_wit-1.8.0-py3-none-any.whl (781 kB)
|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 781 kB 96 kB/s
Collecting google-auth-oauthlib<0.5,>=0.4.1
Downloading google_auth_oauthlib-0.4.3-py2.py3-none-any.whl (18 kB)
Collecting absl-py>=0.4
Downloading absl_py-0.12.0-py3-none-any.whl (129 kB)
|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 129 kB 300 kB/s
Collecting google-auth<2,>=1.6.3
Downloading google_auth-1.27.1-py2.py3-none-any.whl (136 kB)
|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 136 kB 237 kB/s
Collecting markdown>=2.6.8
Downloading Markdown-3.3.4-py3-none-any.whl (97 kB)
|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 97 kB 165 kB/s
Collecting requests<3,>=2.21.0
Downloading requests-2.25.1-py2.py3-none-any.whl (61 kB)
|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 61 kB 107 kB/s
Requirement already satisfied: protobuf>=3.6.0 in /home/chenxin/.local/lib/python3.6/site-packages (from tensorboard->detectron2==0.4) (3.12.2)
Collecting werkzeug>=0.11.15
Downloading Werkzeug-1.0.1-py2.py3-none-any.whl (298 kB)
|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 298 kB 248 kB/s
Collecting cachetools<5.0,>=2.0.0
Downloading cachetools-4.2.1-py3-none-any.whl (12 kB)
Collecting pyasn1-modules>=0.2.1
Downloading pyasn1_modules-0.2.8-py2.py3-none-any.whl (155 kB)
|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 155 kB 303 kB/s
Collecting rsa<5,>=3.1.4
Downloading rsa-4.7.2-py3-none-any.whl (34 kB)
Collecting requests-oauthlib>=0.7.0
Downloading requests_oauthlib-1.3.0-py2.py3-none-any.whl (23 kB)
Collecting importlib-metadata
Downloading importlib_metadata-3.7.3-py3-none-any.whl (12 kB)
Collecting pyasn1<0.5.0,>=0.4.6
Downloading pyasn1-0.4.8-py2.py3-none-any.whl (77 kB)
|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 77 kB 72 kB/s
Collecting idna<3,>=2.5
Downloading idna-2.10-py2.py3-none-any.whl (58 kB)
|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 58 kB 26 kB/s
Collecting urllib3<1.27,>=1.21.1
Downloading urllib3-1.26.4-py2.py3-none-any.whl (153 kB)
|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 153 kB 51 kB/s
Collecting chardet<5,>=3.0.2
Downloading chardet-4.0.0-py2.py3-none-any.whl (178 kB)
|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 178 kB 173 kB/s
Collecting oauthlib>=3.0.0
Downloading oauthlib-3.1.0-py2.py3-none-any.whl (147 kB)
|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 147 kB 149 kB/s
Collecting zipp>=0.5
Downloading zipp-3.4.1-py3-none-any.whl (5.2 kB)
Building wheels for collected packages: fvcore, iopath, pycocotools, termcolor, future
Building wheel for fvcore (setup.py) ... done
Created wheel for fvcore: filename=fvcore-0.1.3.post20210311-py3-none-any.whl size=58459 sha256=4f6d32fed44098812eadc6d52f1e2a4f1ccea7198f2b23ecb0ae0bdd3e8278dd
Stored in directory: /home/chenxin/.cache/pip/wheels/91/28/4f/7dc4f80e68cf39658f00536702429f5c64609eff0e1ebb14cf
Building wheel for iopath (setup.py) ... done
Created wheel for iopath: filename=iopath-0.1.6-py3-none-any.whl size=18268 sha256=b3a03b7c6712a0e831a1294df2bf410fa0f3cdbfd5ea98409a94548968e9bf70
Stored in directory: /home/chenxin/.cache/pip/wheels/69/44/5d/ee2c030db539d80d57ac1455b7318ab4f816c79c3fba67fa53
Building wheel for pycocotools (setup.py) ... done
Created wheel for pycocotools: filename=pycocotools-2.0.2-cp36-cp36m-linux_x86_64.whl size=280386 sha256=7dd486c42c734380425f31e6dc246624ba587425cf64c561abc162da270759f1
Stored in directory: /home/chenxin/.cache/pip/wheels/d8/c2/ba/8f5306f921c2e79ad7b09effdfed6bd966cfcf8c6fe55422d6
Building wheel for termcolor (setup.py) ... done
Created wheel for termcolor: filename=termcolor-1.1.0-py3-none-any.whl size=4829 sha256=aee7d5ce0e4e99f2f616c1840adeac05cc407666c8ab819ccc26437fff753684
Stored in directory: /home/chenxin/.cache/pip/wheels/93/2a/eb/e58dbcbc963549ee4f065ff80a59f274cc7210b6eab962acdc
Building wheel for future (setup.py) ... done
Created wheel for future: filename=future-0.18.2-py3-none-any.whl size=491059 sha256=a7eff42ecb86ff1ec427b09a674241744e821a6cc7a76ac79de18f004e15ce3b
Stored in directory: /home/chenxin/.cache/pip/wheels/6e/9c/ed/4499c9865ac1002697793e0ae05ba6be33553d098f3347fb94
Successfully built fvcore iopath pycocotools termcolor future
Installing collected packages: urllib3, pyasn1, idna, chardet, zipp, rsa, requests, pyasn1-modules, oauthlib, cachetools, requests-oauthlib, pyyaml, portalocker, importlib-metadata, google-auth, yacs, werkzeug, termcolor, tensorboard-plugin-wit, tabulate, markdown, iopath, grpcio, google-auth-oauthlib, absl-py, tensorboard, pydot, pycocotools, omegaconf, fvcore, future, cloudpickle, detectron2
Running setup.py develop for detectron2
Successfully installed absl-py-0.12.0 cachetools-4.2.1 chardet-4.0.0 cloudpickle-1.6.0 detectron2 future-0.18.2 fvcore-0.1.3.post20210311 google-auth-1.27.1 google-auth-oauthlib-0.4.3 grpcio-1.36.1 idna-2.10 importlib-metadata-3.7.3 iopath-0.1.6 markdown-3.3.4 oauthlib-3.1.0 omegaconf-2.0.6 portalocker-2.2.1 pyasn1-0.4.8 pyasn1-modules-0.2.8 pycocotools-2.0.2 pydot-1.4.2 pyyaml-5.4.1 requests-2.25.1 requests-oauthlib-1.3.0 rsa-4.7.2 tabulate-0.8.9 tensorboard-2.4.1 tensorboard-plugin-wit-1.8.0 termcolor-1.1.0 urllib3-1.26.4 werkzeug-1.0.1 yacs-0.1.8 zipp-3.4.1
(detectron2) chenxin@Nitro-AN515:
/Downloads$ git clone --recursive https://github.com/facebookresearch/d2go.git
Cloning into 'd2go'...
remote: Enumerating objects: 24, done.
remote: Counting objects: 100% (24/24), done.
remote: Compressing objects: 100% (22/22), done.
remote: Total 340 (delta 6), reused 12 (delta 2), pack-reused 316
Receiving objects: 100% (340/340), 1.21 MiB | 277.00 KiB/s, done.
Resolving deltas: 100% (100/100), done.

Install PyTorch Nightly (use CUDA 10.2 as example, see details at PyTorch Website):

conda install pytorch torchvision cudatoolkit=10.2 -c pytorch-nightly ------------------------sucess

Install Detectron2 (other installation options at Detectron2):

python -m pip install 'git+https://github.com/facebookresearch/detectron2.git' ------------------------sucess

Install mobile_cv:

python -m pip install 'git+https://github.com/facebookresearch/mobile-vision.git' ------------------------sucess

(detectron2) chenxin@Nitro-AN515:~/Downloads/d2go$ python -m pip install .
Processing /home/chenxin/Downloads/d2go
Collecting importlib
Downloading importlib-1.0.4.zip (7.1 kB)
ERROR: Command errored out with exit status 1:
command: /home/chenxin/anaconda/envs/detectron2/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-nro8gfpo/importlib_a7e920fb95ae4e4abb01d4acc934aa8f/setup.py'"'"'; file='"'"'/tmp/pip-install-nro8gfpo/importlib_a7e920fb95ae4e4abb01d4acc934aa8f/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-uxct38_r
cwd: /tmp/pip-install-nro8gfpo/importlib_a7e920fb95ae4e4abb01d4acc934aa8f/
Complete output (38 lines):
Error processing line 1 of /home/chenxin/.local/lib/python3.6/site-packages/matplotlib-3.3.2-py3.6-nspkg.pth:

  Traceback (most recent call last):
    File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/site.py", line 168, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
  ModuleNotFoundError: No module named 'importlib.util'

Remainder of file ignored
Error processing line 1 of /home/chenxin/.local/lib/python3.6/site-packages/protobuf-3.12.2-py3.6-nspkg.pth:

  Traceback (most recent call last):
    File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/site.py", line 168, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
  ModuleNotFoundError: No module named 'importlib.util'

Remainder of file ignored
Error processing line 1 of /home/chenxin/anaconda/envs/detectron2/lib/python3.6/site-packages/google_auth-1.27.1-py3.9-nspkg.pth:

  Traceback (most recent call last):
    File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/site.py", line 168, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
  ModuleNotFoundError: No module named 'importlib.util'

Remainder of file ignored
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/chenxin/.local/lib/python3.6/site-packages/setuptools/__init__.py", line 5, in <module>
    import distutils.core
  File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/distutils/core.py", line 16, in <module>
    from distutils.dist import Distribution
  File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/distutils/dist.py", line 19, in <module>
    from distutils.util import check_environ, strtobool, rfc822_escape
  File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/distutils/util.py", line 9, in <module>
    import importlib.util
ModuleNotFoundError: No module named 'importlib.util'
----------------------------------------

WARNING: Discarding https://files.pythonhosted.org/packages/31/77/3781f65cafe55480b56914def99022a5d2965a4bb269655c89ef2f1de3cd/importlib-1.0.4.zip#sha256=b6ee7066fea66e35f8d0acee24d98006de1a0a8a94a8ce6efe73a9a23c8d9826 (from https://pypi.org/simple/importlib/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Downloading importlib-1.0.3.zip (2.4 kB)
ERROR: Command errored out with exit status 1:
command: /home/chenxin/anaconda/envs/detectron2/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-nro8gfpo/importlib_0a9cfc25b6a343a2b72faddd432840eb/setup.py'"'"'; file='"'"'/tmp/pip-install-nro8gfpo/importlib_0a9cfc25b6a343a2b72faddd432840eb/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-oqd447x9
cwd: /tmp/pip-install-nro8gfpo/importlib_0a9cfc25b6a343a2b72faddd432840eb/
Complete output (38 lines):
Error processing line 1 of /home/chenxin/.local/lib/python3.6/site-packages/matplotlib-3.3.2-py3.6-nspkg.pth:

  Traceback (most recent call last):
    File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/site.py", line 168, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
  ModuleNotFoundError: No module named 'importlib.util'

Remainder of file ignored
Error processing line 1 of /home/chenxin/.local/lib/python3.6/site-packages/protobuf-3.12.2-py3.6-nspkg.pth:

  Traceback (most recent call last):
    File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/site.py", line 168, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
  ModuleNotFoundError: No module named 'importlib.util'

Remainder of file ignored
Error processing line 1 of /home/chenxin/anaconda/envs/detectron2/lib/python3.6/site-packages/google_auth-1.27.1-py3.9-nspkg.pth:

  Traceback (most recent call last):
    File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/site.py", line 168, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
  ModuleNotFoundError: No module named 'importlib.util'

Remainder of file ignored
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/chenxin/.local/lib/python3.6/site-packages/setuptools/__init__.py", line 5, in <module>
    import distutils.core
  File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/distutils/core.py", line 16, in <module>
    from distutils.dist import Distribution
  File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/distutils/dist.py", line 19, in <module>
    from distutils.util import check_environ, strtobool, rfc822_escape
  File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/distutils/util.py", line 9, in <module>
    import importlib.util
ModuleNotFoundError: No module named 'importlib.util'
----------------------------------------

WARNING: Discarding https://files.pythonhosted.org/packages/66/79/f2a40227179e425f5350ad95c15ad2af33c34d22294eb4099e6cda967fbd/importlib-1.0.3.zip#sha256=65f342a604a2e1028707c5e055266ab2431c26e20fe10780b423320870884dac (from https://pypi.org/simple/importlib/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Downloading importlib-1.0.3.tar.gz (1.7 kB)
ERROR: Command errored out with exit status 1:
command: /home/chenxin/anaconda/envs/detectron2/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-nro8gfpo/importlib_c3bb41bda7fe453ab06ac707430e005a/setup.py'"'"'; file='"'"'/tmp/pip-install-nro8gfpo/importlib_c3bb41bda7fe453ab06ac707430e005a/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-5pbjv93z
cwd: /tmp/pip-install-nro8gfpo/importlib_c3bb41bda7fe453ab06ac707430e005a/
Complete output (38 lines):
Error processing line 1 of /home/chenxin/.local/lib/python3.6/site-packages/matplotlib-3.3.2-py3.6-nspkg.pth:

  Traceback (most recent call last):
    File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/site.py", line 168, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
  ModuleNotFoundError: No module named 'importlib.util'

Remainder of file ignored
Error processing line 1 of /home/chenxin/.local/lib/python3.6/site-packages/protobuf-3.12.2-py3.6-nspkg.pth:

  Traceback (most recent call last):
    File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/site.py", line 168, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
  ModuleNotFoundError: No module named 'importlib.util'

Remainder of file ignored
Error processing line 1 of /home/chenxin/anaconda/envs/detectron2/lib/python3.6/site-packages/google_auth-1.27.1-py3.9-nspkg.pth:

  Traceback (most recent call last):
    File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/site.py", line 168, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
  ModuleNotFoundError: No module named 'importlib.util'

Remainder of file ignored
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/chenxin/.local/lib/python3.6/site-packages/setuptools/__init__.py", line 5, in <module>
    import distutils.core
  File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/distutils/core.py", line 16, in <module>
    from distutils.dist import Distribution
  File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/distutils/dist.py", line 19, in <module>
    from distutils.util import check_environ, strtobool, rfc822_escape
  File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/distutils/util.py", line 9, in <module>
    import importlib.util
ModuleNotFoundError: No module named 'importlib.util'
----------------------------------------

WARNING: Discarding https://files.pythonhosted.org/packages/0e/9c/daad476c540c4c36e7b35cf367331f0acf10d09d112cc5083c3e16a77347/importlib-1.0.3.tar.gz#sha256=01fc0a2a1e01990a97b096615c11328fa4306ced1733c98d884160387760d479 (from https://pypi.org/simple/importlib/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Downloading importlib-1.0.3.tar.bz2 (1.8 kB)
ERROR: Command errored out with exit status 1:
command: /home/chenxin/anaconda/envs/detectron2/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-nro8gfpo/importlib_d767cec8b608466c95db64757004f920/setup.py'"'"'; file='"'"'/tmp/pip-install-nro8gfpo/importlib_d767cec8b608466c95db64757004f920/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-au6x0p87
cwd: /tmp/pip-install-nro8gfpo/importlib_d767cec8b608466c95db64757004f920/
Complete output (38 lines):
Error processing line 1 of /home/chenxin/.local/lib/python3.6/site-packages/matplotlib-3.3.2-py3.6-nspkg.pth:

  Traceback (most recent call last):
    File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/site.py", line 168, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
  ModuleNotFoundError: No module named 'importlib.util'

Remainder of file ignored
Error processing line 1 of /home/chenxin/.local/lib/python3.6/site-packages/protobuf-3.12.2-py3.6-nspkg.pth:

  Traceback (most recent call last):
    File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/site.py", line 168, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
  ModuleNotFoundError: No module named 'importlib.util'

Remainder of file ignored
Error processing line 1 of /home/chenxin/anaconda/envs/detectron2/lib/python3.6/site-packages/google_auth-1.27.1-py3.9-nspkg.pth:

  Traceback (most recent call last):
    File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/site.py", line 168, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
  ModuleNotFoundError: No module named 'importlib.util'

Remainder of file ignored
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/chenxin/.local/lib/python3.6/site-packages/setuptools/__init__.py", line 5, in <module>
    import distutils.core
  File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/distutils/core.py", line 16, in <module>
    from distutils.dist import Distribution
  File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/distutils/dist.py", line 19, in <module>
    from distutils.util import check_environ, strtobool, rfc822_escape
  File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/distutils/util.py", line 9, in <module>
    import importlib.util
ModuleNotFoundError: No module named 'importlib.util'
----------------------------------------

WARNING: Discarding https://files.pythonhosted.org/packages/da/15/3e87aa363a1fb380cf0532a936d203bd19eda03919271249811e8b019e6d/importlib-1.0.3.tar.bz2#sha256=7cbb514a352f821c69b8e8bdaa6b2e59728547a8965503c758652c2826d157b5 (from https://pypi.org/simple/importlib/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Downloading importlib-1.0.2.zip (2.5 kB)
ERROR: Command errored out with exit status 1:
command: /home/chenxin/anaconda/envs/detectron2/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-nro8gfpo/importlib_4be79e4a512b4ed498481d0193136e19/setup.py'"'"'; file='"'"'/tmp/pip-install-nro8gfpo/importlib_4be79e4a512b4ed498481d0193136e19/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-t9oxot3j
cwd: /tmp/pip-install-nro8gfpo/importlib_4be79e4a512b4ed498481d0193136e19/
Complete output (38 lines):
Error processing line 1 of /home/chenxin/.local/lib/python3.6/site-packages/matplotlib-3.3.2-py3.6-nspkg.pth:

  Traceback (most recent call last):
    File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/site.py", line 168, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
  ModuleNotFoundError: No module named 'importlib.util'

Remainder of file ignored
Error processing line 1 of /home/chenxin/.local/lib/python3.6/site-packages/protobuf-3.12.2-py3.6-nspkg.pth:

  Traceback (most recent call last):
    File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/site.py", line 168, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
  ModuleNotFoundError: No module named 'importlib.util'

Remainder of file ignored
Error processing line 1 of /home/chenxin/anaconda/envs/detectron2/lib/python3.6/site-packages/google_auth-1.27.1-py3.9-nspkg.pth:

  Traceback (most recent call last):
    File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/site.py", line 168, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
  ModuleNotFoundError: No module named 'importlib.util'

Remainder of file ignored
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/chenxin/.local/lib/python3.6/site-packages/setuptools/__init__.py", line 5, in <module>
    import distutils.core
  File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/distutils/core.py", line 16, in <module>
    from distutils.dist import Distribution
  File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/distutils/dist.py", line 19, in <module>
    from distutils.util import check_environ, strtobool, rfc822_escape
  File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/distutils/util.py", line 9, in <module>
    import importlib.util
ModuleNotFoundError: No module named 'importlib.util'
----------------------------------------

WARNING: Discarding https://files.pythonhosted.org/packages/a2/8c/9d1f912e8edd4c583f377a01be3688ac9aca4e47f0faaba88256a278b77f/importlib-1.0.2.zip#sha256=0e4d8ff0ec484f21d36b6155f70bc9efb76cb5640c6830e60779c29f1d4a22d6 (from https://pypi.org/simple/importlib/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Downloading importlib-1.0.2.tar.gz (1.7 kB)
ERROR: Command errored out with exit status 1:
command: /home/chenxin/anaconda/envs/detectron2/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-nro8gfpo/importlib_c71a2f0a6b394a2c8261eabe999cb4da/setup.py'"'"'; file='"'"'/tmp/pip-install-nro8gfpo/importlib_c71a2f0a6b394a2c8261eabe999cb4da/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-m1_6c5fs
cwd: /tmp/pip-install-nro8gfpo/importlib_c71a2f0a6b394a2c8261eabe999cb4da/
Complete output (38 lines):
Error processing line 1 of /home/chenxin/.local/lib/python3.6/site-packages/matplotlib-3.3.2-py3.6-nspkg.pth:

  Traceback (most recent call last):
    File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/site.py", line 168, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
  ModuleNotFoundError: No module named 'importlib.util'

Remainder of file ignored
Error processing line 1 of /home/chenxin/.local/lib/python3.6/site-packages/protobuf-3.12.2-py3.6-nspkg.pth:

  Traceback (most recent call last):
    File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/site.py", line 168, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
  ModuleNotFoundError: No module named 'importlib.util'

Remainder of file ignored
Error processing line 1 of /home/chenxin/anaconda/envs/detectron2/lib/python3.6/site-packages/google_auth-1.27.1-py3.9-nspkg.pth:

  Traceback (most recent call last):
    File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/site.py", line 168, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
  ModuleNotFoundError: No module named 'importlib.util'

Remainder of file ignored
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/chenxin/.local/lib/python3.6/site-packages/setuptools/__init__.py", line 5, in <module>
    import distutils.core
  File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/distutils/core.py", line 16, in <module>
    from distutils.dist import Distribution
  File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/distutils/dist.py", line 19, in <module>
    from distutils.util import check_environ, strtobool, rfc822_escape
  File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/distutils/util.py", line 9, in <module>
    import importlib.util
ModuleNotFoundError: No module named 'importlib.util'
----------------------------------------

WARNING: Discarding https://files.pythonhosted.org/packages/65/1f/87549f328d46842f44a7812410d5f018a0818a5105c6a1e4910756638341/importlib-1.0.2.tar.gz#sha256=24d0966aa76859b288485803f310076512f87377e6c9afe9c28c52a8ccdd328c (from https://pypi.org/simple/importlib/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Downloading importlib-1.0.2.tar.bz2 (1.9 kB)
ERROR: Command errored out with exit status 1:
command: /home/chenxin/anaconda/envs/detectron2/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-nro8gfpo/importlib_186417fc46a04cd18c711fc3c62e3822/setup.py'"'"'; file='"'"'/tmp/pip-install-nro8gfpo/importlib_186417fc46a04cd18c711fc3c62e3822/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-hrenf1ji
cwd: /tmp/pip-install-nro8gfpo/importlib_186417fc46a04cd18c711fc3c62e3822/
Complete output (38 lines):
Error processing line 1 of /home/chenxin/.local/lib/python3.6/site-packages/matplotlib-3.3.2-py3.6-nspkg.pth:

  Traceback (most recent call last):
    File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/site.py", line 168, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
  ModuleNotFoundError: No module named 'importlib.util'

Remainder of file ignored
Error processing line 1 of /home/chenxin/.local/lib/python3.6/site-packages/protobuf-3.12.2-py3.6-nspkg.pth:

  Traceback (most recent call last):
    File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/site.py", line 168, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
  ModuleNotFoundError: No module named 'importlib.util'

Remainder of file ignored
Error processing line 1 of /home/chenxin/anaconda/envs/detectron2/lib/python3.6/site-packages/google_auth-1.27.1-py3.9-nspkg.pth:

  Traceback (most recent call last):
    File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/site.py", line 168, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
  ModuleNotFoundError: No module named 'importlib.util'

Remainder of file ignored
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/chenxin/.local/lib/python3.6/site-packages/setuptools/__init__.py", line 5, in <module>
    import distutils.core
  File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/distutils/core.py", line 16, in <module>
    from distutils.dist import Distribution
  File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/distutils/dist.py", line 19, in <module>
    from distutils.util import check_environ, strtobool, rfc822_escape
  File "/home/chenxin/anaconda/envs/detectron2/lib/python3.6/distutils/util.py", line 9, in <module>
    import importlib.util
ModuleNotFoundError: No module named 'importlib.util'
----------------------------------------

WARNING: Discarding https://files.pythonhosted.org/packages/5c/12/8f817b1fac707b23f26f4f07781474d516b6cb6fdeb2b7b88bc7863702e0/importlib-1.0.2.tar.bz2#sha256=039b16938104aab9415c0f089e6be04843dced1643fbb11c16a18917af79d58e (from https://pypi.org/simple/importlib/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Downloading importlib-1.0.1.zip (2.5 kB)
^Z
[2]+ Stopped python -m pip install .

Export model as .half()

Running

  convert_and_export_predictor(
       cfg,
       copy.deepcopy(model.half()),
       conversion_type,
       path,
       data_loader,
   )

Of course with a data loader that returns half() tensors as well results in the following.

File "/usr/local/lib/python3.8/dist-packages/d2go/export/api.py", line 185, in _export_single_model
return ModelInfo(
TypeError: __new__() got an unexpected keyword argument 'export_method'

It would be nice to export the model to be float16

exporting keypoint_rcnn_fbnetv3a_dsmask_C4 pretrained model

Hello all

Could anyone ever export torchscript file for keypoint_rcnn_fbnetv3a_dsmask_C4 pre-trained model using create_d2go.py file?
I altered the Wrapper to return "keypoints" beside others ("boxes","scores","labels"). "Keypoints" are in the out[3] in Wrapper.
res["scores"] = out[2]

Indee the code I use to export the model is:
`
#!/usr/bin/env python3

import contextlib
import copy
import os
import unittest
from PIL import Image

import torch
from d2go.export.api import convert_and_export_predictor
from d2go.export.d2_meta_arch import patch_d2_meta_arch
from d2go.runner import create_runner, GeneralizedRCNNRunner
from d2go.model_zoo import model_zoo

from mobile_cv.common.misc.file_utils import make_temp_directory
from d2go.utils.testing.data_loader_helper import LocalImageGenerator, register_toy_dataset
from d2go.utils.testing.data_loader_helper import create_fake_detection_data_loader

patch_d2_meta_arch()


def test_export_torchvision_format():
    cfg_name = 'keypoint_rcnn_fbnetv3a_dsmask_C4.yaml'
    pytorch_model = model_zoo.get(cfg_name, trained=True)
    # pytorch_model.training=False
    # pytorch_model.eval()
    from typing import List, Dict
    class Wrapper(torch.nn.Module):
        def __init__(self, model):
            super().__init__()
            self.model = model
            coco_idx_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
                             27, 28, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 46, 47, 48, 49, 50, 51,
                             52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 67, 70, 72, 73, 74, 75, 76, 77,
                             78, 79, 80, 81, 82, 84, 85, 86, 87, 88, 89, 90, 91]

            self.coco_idx = torch.tensor(coco_idx_list)

        def forward(self, inputs: List[torch.Tensor]):
            x = inputs[0].unsqueeze(0) * 255
            scale = 320.0 / min(x.shape[-2], x.shape[-1])
            x = torch.nn.functional.interpolate(x, scale_factor=scale, mode="bilinear", align_corners=True, recompute_scale_factor=True)
            out = self.model(x[0])

            ##### out[3] is "pred_keypoints", out[0] is "boxes", out[4] is "scores",out[1] is "labels"
            res=( out[3],
            out[0] / scale,
            torch.index_select(self.coco_idx, 0, out[1]),
            out[4],)

            return res

    size_divisibility = max(pytorch_model.backbone.size_divisibility, 10)
    h, w = size_divisibility, size_divisibility * 2
    with create_fake_detection_data_loader(h, w, is_train=False) as data_loader:
        predictor_path = convert_and_export_predictor(
            model_zoo.get_config(cfg_name),
            copy.deepcopy(pytorch_model),
            "torchscript_int8@tracing",
            './',
            data_loader,
        )

        orig_model = torch.jit.load(os.path.join(predictor_path, "model.jit"))
        wrapped_model = Wrapper(orig_model)
        # optionally do a forward        
        wrapped_model([torch.rand(3, 600, 600)])
        scripted_model = torch.jit.script(wrapped_model)
        scripted_model.save("d2go_tracker.pt")
`
when I use exported .pt file in android I get corrupted keypoints coordinates and it seems it's due to the TracerWarnings meanwhile I export torchscript file ( Converting a tensor to other python types cause the value to be constant in the torchscript output file)

I am pretty sure the input format of the forwarding path in android is correct. The output of the model in android for keypoint_rcnn_fbnetv3a_dsmask_C4 model is "boxes","scores","labels","keypoints". but "keypoints" are not correct. others are fine and I can draw boxes around "persons".

** my meaning of corrupted keypoints** : for each keypoint the model in android returns the same (x,y,probability)
## Expected behavior:
get the same output as the time I run the model in python3 with DemoPredicator. 

Fail to implement the quantization-aware training of demo

Instructions To Reproduce the ๐Ÿ› Bug:

I already made sure that d2go could train with custom datasets and predict.
I wanna use the quantization-aware-training this function by d2go.

  1. Run the command from Getting Started with D2Go

I added a part for registering custom dataset in train_net.py

   from detectron2.data import MetadataCatalog, DatasetCatalog
   from detectron2.data.datasets import register_coco_instances

   register_coco_instances("my_dataset_train", {}, "datasets/train_Images/trainval_area.json", "datasets/train_Images/")
   register_coco_instances("my_dataset_val", {}, "datasets/test_Images/testval_area.json", "datasets/test_Images/")

   my_dataset_train_metadata = MetadataCatalog.get("my_dataset_train")
   dataset_dicts = DatasetCatalog.get("my_dataset_train")

   my_dataset_val_metadata = MetadataCatalog.get("my_dataset_val")
   val_dataset_dicts = DatasetCatalog.get("my_dataset_val")

   for dd in ["my_dataset_train", "my_dataset_val"]:
       MetadataCatalog.get(dd).set(thing_classes=['top', 'bottom', 'top_ov', 'bottom_ov'])

Also, added the num_class parameter before setup_after_launch()

    cfg.defrost()
    cfg.MODEL.ROI_HEADS.NUM_CLASSES = 4
    cfg.freeze()

Add the dataset in qat_faster_rcnn_fbnetv3a_C4.yaml file

DATASETS:
  TRAIN: ("my_dataset_train",)
  TEST: ("my_dataset_val",)

Command:

$ python3 tools/train_net.py --config-file configs/qat_faster_rcnn_fbnetv3a_C4.yaml
MODEL.WEIGHTS model_0479999.pth

I encountered this error messages below:

Output:

[03/29 10:34:36 d2go.modeling.model_ema]: Using Model EMA.
Traceback (most recent call last):
  File "/home/chieh/.local/lib/python3.6/site-packages/mobile_cv/common/misc/py.py", line 122, in new_func
    return func(*args, **kwargs)
  File "tools/train_net.py", line 39, in main
    model = runner.build_model(cfg)
  File "/home/chieh/.local/lib/python3.6/site-packages/d2go/runner/default_runner.py", line 251, in build_model
    cfg, model, enable_fake_quant=eval_only, enable_observer=False
  File "/home/chieh/.local/lib/python3.6/site-packages/d2go/modeling/quantization.py", line 217, in wrapper
    return quant_func(cfg, model, *args, **kwargs)
  File "/home/chieh/.local/lib/python3.6/site-packages/d2go/modeling/quantization.py", line 336, in setup_qat_model
    model = model.prepare_for_quant(cfg)
  File "/home/chieh/.local/lib/python3.6/site-packages/d2go/export/d2_meta_arch.py", line 117, in d2_meta_arch_prepare_for_quant
    model = fuse_utils.fuse_model(model, inplace=True)
  File "/home/chieh/.local/lib/python3.6/site-packages/mobile_cv/arch/utils/fuse_utils.py", line 162, in fuse_model
    return fuse_model_inplace(model)
  File "/home/chieh/.local/lib/python3.6/site-packages/mobile_cv/arch/utils/fuse_utils.py", line 155, in fuse_model_inplace
    children[name] = fuse_model_inplace(child)
  File "/home/chieh/.local/lib/python3.6/site-packages/mobile_cv/arch/utils/fuse_utils.py", line 155, in fuse_model_inplace
    children[name] = fuse_model_inplace(child)
  File "/home/chieh/.local/lib/python3.6/site-packages/mobile_cv/arch/utils/fuse_utils.py", line 155, in fuse_model_inplace
    children[name] = fuse_model_inplace(child)
  [Previous line repeated 1 more time]
  File "/home/chieh/.local/lib/python3.6/site-packages/mobile_cv/arch/utils/fuse_utils.py", line 152, in fuse_model_inplace
    model = fuse_convbnrelu(model, inplace=True)
  File "/home/chieh/.local/lib/python3.6/site-packages/mobile_cv/arch/utils/fuse_utils.py", line 146, in fuse_convbnrelu
    ret, fuse_names, inplace=True, fuser_func=fuse_more_modules
  File "/usr/local/lib/python3.6/dist-packages/torch/quantization/fuse_modules.py", line 131, in fuse_modules
    _fuse_modules(model, module_list, fuser_func)
  File "/usr/local/lib/python3.6/dist-packages/torch/quantization/fuse_modules.py", line 74, in _fuse_modules
    new_mod_list = fuser_func(mod_list)
  File "/home/chieh/.local/lib/python3.6/site-packages/mobile_cv/arch/utils/fuse_utils.py", line 95, in fuse_more_modules
    return fuse_known_modules(mod_list)
  File "/usr/local/lib/python3.6/dist-packages/torch/quantization/fuse_modules.py", line 46, in fuse_known_modules
    raise NotImplementedError("Cannot fuse modules: {}".format(types))
NotImplementedError: Cannot fuse modules: (<class 'torch.nn.modules.conv.Conv2d'>, <class 'mobile_cv.arch.layers.batch_norm.NaiveSyncBatchNorm'>, <class 'torch.nn.modules.activation.ReLU'>)
> /usr/local/lib/python3.6/dist-packages/torch/quantization/fuse_modules.py(46)fuse_known_modules()
-> raise NotImplementedError("Cannot fuse modules: {}".format(types))
  1. What exact command you run:
python3 tools/train_net.py --config-file configs/qat_faster_rcnn_fbnetv3a_C4.yaml MODEL.WEIGHTS model_0479999.pth  
  1. Here is my full logs:
    log.txt

  2. Here is my config.yaml: (Because github cannot support yaml, I amended to txt file)
    config.txt

Expected behavior:

I wish I can implement the quantization-aware-training with custom dataset without any error.

Thank you!!

Best regards,
Chieh

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.