[jacinto-ai/pytorch-jacinto-ai-devkit.git] / modules / pytorch_jacinto_ai / xvision / models / multi_input_net.py
diff --git a/modules/pytorch_jacinto_ai/xvision/models/multi_input_net.py b/modules/pytorch_jacinto_ai/xvision/models/multi_input_net.py
index 3d9193f12600f6e51245802ffb797290231e5b61..259a84208bb4b6d4d932f08243868c739258d512 100644 (file)
+#################################################################################
+# Copyright (c) 2018-2021, Texas Instruments Incorporated - http://www.ti.com
+# All Rights Reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# * Neither the name of the copyright holder nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+#################################################################################
+# Some parts of the code are borrowed from: https://github.com/pytorch/vision
+# with the following license:
+#
+# BSD 3-Clause License
+#
+# Copyright (c) Soumith Chintala 2016,
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# * Neither the name of the copyright holder nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+#################################################################################
+
import copy
import torch
from ... import xnn
from .mobilenetv2 import MobileNetV2TV
from .resnet import resnet50_with_model_config
-from .regnet import regnetx800mf_with_model_config
+from .regnet import regnetx400mf_with_model_config, regnetx800mf_with_model_config, \
+ regnetx1p6gf_with_model_config, regnetx3p2gf_with_model_config
try: from .mobilenetv2_ericsun_internal import *
except: pass
except: pass
__all__ = ['MultiInputNet', 'mobilenet_v2_tv_mi4', 'mobilenet_v2_tv_gws_mi4', 'mobilenet_v2_ericsun_mi4',
- 'MobileNetV2TVMI4', 'MobileNetV2TVNV12MI4', 'ResNet50MI4']
+ 'MobileNetV2TVMI4', 'MobileNetV2TVNV12MI4', 'ResNet50MI4',
+ 'RegNetX400MFMI4', 'RegNetX800MFMI4', 'RegNetX1p6GFMI4', 'RegNetX3p2GFMI4']
###################################################
###################################################
+# thes are multi input blocks, but their num_input_blocks is set to 0
+class RegNetX400MFMI4(MultiInputNet):
+ def __init__(self, model_config):
+ model_config.num_input_blocks = 2
+ model_config.fuse_channels = 64
+ super().__init__(regnetx400mf_with_model_config, model_config)
+
+
# thes are multi input blocks, but their num_input_blocks is set to 0
class RegNetX800MFMI4(MultiInputNet):
def __init__(self, model_config):
model_config.num_input_blocks = 2
model_config.fuse_channels = 64
- super().__init__(regnetx800mf_with_model_config, model_config)
\ No newline at end of file
+ super().__init__(regnetx800mf_with_model_config, model_config)
+
+
+# thes are multi input blocks, but their num_input_blocks is set to 0
+class RegNetX1p6GFMI4(MultiInputNet):
+ def __init__(self, model_config):
+ model_config.num_input_blocks = 2
+ model_config.fuse_channels = 64
+ super().__init__(regnetx1p6gf_with_model_config, model_config)
+
+
+# thes are multi input blocks, but their num_input_blocks is set to 0
+class RegNetX3p2GFMI4(MultiInputNet):
+ def __init__(self, model_config):
+ model_config.num_input_blocks = 2
+ model_config.fuse_channels = 64
+ super().__init__(regnetx3p2gf_with_model_config, model_config)
\ No newline at end of file