code
stringlengths
17
6.64M
class ROIActionHead(torch.nn.Module): '\n Generic Action Head class.\n ' def __init__(self, cfg, dim_in): super(ROIActionHead, self).__init__() self.feature_extractor = make_roi_action_feature_extractor(cfg, dim_in) self.predictor = make_roi_action_predictor(cfg, self.feature_ex...
def build_roi_action_head(cfg, dim_in): return ROIActionHead(cfg, dim_in)
class Mlp(nn.Module): def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.0): super().__init__() out_features = (out_features or in_features) hidden_features = (hidden_features or in_features) self.fc1 = nn.Linear(in_features, hidden_...
class Attention(nn.Module): def __init__(self, dim, num_heads=8, qkv_bias=False, qk_scale=None, attn_drop=0.0, proj_drop=0.0): super().__init__() self.num_heads = num_heads head_dim = (dim // num_heads) self.scale = (qk_scale or (head_dim ** (- 0.5))) self.qkv = nn.Linear(...
class Block(nn.Module): def __init__(self, dim, num_heads, mlp_ratio=4.0, qkv_bias=False, qk_scale=None, drop=0.0, attn_drop=0.0, drop_path=0.0, act_layer=nn.GELU, norm_layer=nn.LayerNorm): super().__init__() self.norm1 = norm_layer(dim) self.attn = Attention(dim, num_heads=num_heads, qkv...
class PoseTransformer(nn.Module): def __init__(self, num_frame=1, num_joints=17, in_chans=2, embed_dim_ratio=32, depth=4, num_heads=8, mlp_ratio=2.0, qkv_bias=True, qk_scale=None, drop_rate=0.0, attn_drop_rate=0.0, drop_path_rate=0.2, norm_layer=None): ' ##########hybrid_backbone=None, representation_...
@registry.ROI_ACTION_PREDICTORS.register('FCPredictor') class FCPredictor(nn.Module): def __init__(self, config, dim_in): super(FCPredictor, self).__init__() num_classes = config.MODEL.ROI_ACTION_HEAD.NUM_CLASSES dropout_rate = config.MODEL.ROI_ACTION_HEAD.DROPOUT_RATE if (dropout...
def make_roi_action_predictor(cfg, dim_in): func = registry.ROI_ACTION_PREDICTORS[cfg.MODEL.ROI_ACTION_HEAD.PREDICTOR] return func(cfg, dim_in)
class Combined3dROIHeads(torch.nn.ModuleDict): def __init__(self, cfg, heads): super(Combined3dROIHeads, self).__init__(heads) self.cfg = cfg.clone() def forward(self, slow_features, fast_features, boxes, objects=None, keypoints=None, extras={}, part_forward=(- 1)): (result, loss_act...
def build_3d_roi_heads(cfg, dim_in): roi_heads = [] roi_heads.append(('action', build_roi_action_head(cfg, dim_in))) if roi_heads: roi_heads = Combined3dROIHeads(cfg, roi_heads) return roi_heads
def make_optimizer(cfg, model): params = [] bn_param_set = set() transformer_param_set = set() for (name, module) in model.named_modules(): if isinstance(module, (nn.BatchNorm1d, nn.BatchNorm2d, nn.BatchNorm3d)): bn_param_set.add((name + '.weight')) bn_param_set.add((na...
def make_lr_scheduler(cfg, optimizer): scheduler = cfg.SOLVER.SCHEDULER if (scheduler not in ('half_period_cosine', 'warmup_multi_step')): raise ValueError('Scheduler not available') if (scheduler == 'warmup_multi_step'): return WarmupMultiStepLR(optimizer, cfg.SOLVER.STEPS, cfg.SOLVER.GAM...
class WarmupMultiStepLR(torch.optim.lr_scheduler._LRScheduler): def __init__(self, optimizer, milestones, gamma=0.1, warmup_factor=(1.0 / 3), warmup_iters=500, warmup_method='linear', last_epoch=(- 1)): if (not (list(milestones) == sorted(milestones))): raise ValueError('Milestones should be ...
class HalfPeriodCosStepLR(torch.optim.lr_scheduler._LRScheduler): def __init__(self, optimizer, warmup_factor=(1.0 / 3), warmup_iters=8000, max_iters=60000, warmup_method='linear', last_epoch=(- 1)): if (warmup_method not in ('constant', 'linear')): raise ValueError("Only 'constant' or 'linea...
class MemoryPool(object): def __init__(self): self.cache = defaultdict(dict) def update(self, update_info): for (movie_id, feature_per_movie) in update_info.items(): self.cache[movie_id].update(feature_per_movie) def update_list(self, update_info_list): for update_in...
def _block_set(ia_blocks): if ((len(ia_blocks) > 0) and isinstance(ia_blocks[0], list)): ia_blocks = list(itertools.chain.from_iterable(ia_blocks)) return ia_blocks
def has_person(ia_config): ia_blocks = _block_set(ia_config.I_BLOCK_LIST) return (ia_config.ACTIVE and ('P' in ia_blocks) and (ia_config.MAX_PERSON > 0))
def has_object(ia_config): ia_blocks = _block_set(ia_config.I_BLOCK_LIST) return (ia_config.ACTIVE and ('O' in ia_blocks) and (ia_config.MAX_OBJECT > 0))
def has_memory(ia_config): ia_blocks = _block_set(ia_config.I_BLOCK_LIST) return (ia_config.ACTIVE and ('M' in ia_blocks) and (ia_config.MAX_PER_SEC > 0))
def has_hand(ia_config): ia_blocks = _block_set(ia_config.I_BLOCK_LIST) return (ia_config.ACTIVE and ('H' in ia_blocks) and (ia_config.MAX_HAND > 0))
def _rename_weights(weights, weight_map): logger = logging.getLogger(__name__) logger.info('Remapping C2 weights') max_c2_key_size = max([len(k) for k in weight_map.values()]) new_weights = OrderedDict() for k in weight_map: c2_name = weight_map[k] logger.info('C2 name: {: <{}} map...
def _load_c2_pickled_weights(file_path): with open(file_path, 'rb') as f: if torch._six.PY3: data = pickle.load(f, encoding='latin1') else: data = pickle.load(f) if ('blobs' in data): weights = data['blobs'] else: weights = data return weights
def load_c2_format(f, weight_map): state_dict = _load_c2_pickled_weights(f) state_dict = _rename_weights(state_dict, weight_map) return dict(model=state_dict)
class Checkpointer(object): def __init__(self, model, optimizer=None, scheduler=None, save_dir='', save_to_disk=None, logger=None): self.model = model self.optimizer = optimizer self.scheduler = scheduler self.save_dir = save_dir self.save_to_disk = save_to_disk if...
class ActionCheckpointer(Checkpointer): def __init__(self, cfg, model, optimizer=None, scheduler=None, save_dir='', save_to_disk=None, logger=None): super(ActionCheckpointer, self).__init__(model, optimizer, scheduler, save_dir, save_to_disk, logger) self.cfg = cfg.clone() def _load_file(sel...
def get_world_size(): if (not dist.is_available()): return 1 if (not dist.is_initialized()): return 1 return dist.get_world_size()
def get_rank(): if (not dist.is_available()): return 0 if (not dist.is_initialized()): return 0 return dist.get_rank()
def is_main_process(): return (get_rank() == 0)
def synchronize(group=None): '\n Helper function to synchronize (barrier) among all processes when\n using distributed training\n ' if (not dist.is_available()): return if (not dist.is_initialized()): return if (group is None): group = _get_global_gloo_group() worl...
@functools.lru_cache() def _get_global_gloo_group(): '\n Return a process group based on gloo backend, containing all the ranks\n The result is cached.\n ' if (dist.get_backend() == 'nccl'): return dist.new_group(backend='gloo') else: return dist.group.WORLD
def _serialize_to_tensor(data, group): backend = dist.get_backend(group) assert (backend in ['gloo', 'nccl']) device = torch.device(('cpu' if (backend == 'gloo') else 'cuda')) buffer = pickle.dumps(data) storage = torch.ByteStorage.from_buffer(buffer) tensor = torch.ByteTensor(storage).to(devi...
def _pad_to_largest_tensor(tensor, group): '\n Returns:\n list[int]: size of the tensor, on each rank\n Tensor: padded tensor that has the max size\n ' world_size = dist.get_world_size(group=group) assert (world_size >= 1), 'comm.all_gather must be called from ranks within the given gr...
def all_gather(data, group=None): '\n Run all_gather on arbitrary picklable data (not necessarily tensors).\n Args:\n data: any picklable object\n group: a torch process group. By default, will use a group which\n contains all ranks on gloo backend.\n Returns:\n list[data]...
def gather(data, dst=0, group=None): '\n Run gather on arbitrary picklable data (not necessarily tensors).\n Args:\n data: any picklable object\n dst (int): destination rank\n group: a torch process group. By default, will use a group which\n contains all ranks on gloo backen...
def reduce_dict(input_dict, average=True): '\n Args:\n input_dict (dict): all the values will be reduced\n average (bool): whether to do average or sum\n Reduce the values in the dictionary from all processes so that process with rank\n 0 has the averaged results. Returns a dict with the sa...
def all_reduce(tensor, average=False): world_size = get_world_size() if (world_size < 2): return dist.all_reduce(tensor) if average: tensor /= world_size
def setup_logger(name, save_dir, distributed_rank, filename=None): logger = logging.getLogger(name) logger.setLevel(logging.DEBUG) logger.propagate = False if (distributed_rank > 0): return logger ch = logging.StreamHandler(stream=sys.stdout) ch.setLevel(logging.DEBUG) formatter = ...
def setup_tblogger(save_dir, distributed_rank): if (distributed_rank > 0): return None from tensorboardX import SummaryWriter tbdir = os.path.join(save_dir, 'tb') os.makedirs(tbdir, exist_ok=True) tblogger = SummaryWriter(tbdir) return tblogger
class SmoothedValue(object): 'Track a series of values and provide access to smoothed values over a\n window or the global series average.\n ' def __init__(self, window_size=20): self.deque = deque(maxlen=window_size) self.series = [] self.total = 0.0 self.count = 0 ...
class MetricLogger(object): def __init__(self, delimiter='\t'): self.meters = defaultdict(SmoothedValue) self.delimiter = delimiter def update(self, **kwargs): for (k, v) in kwargs.items(): if isinstance(v, torch.Tensor): v = v.item() assert is...
def align_and_update_state_dicts(model_state_dict, loaded_state_dict, no_head): "\n Strategy: suppose that the models that we will create will have prefixes appended\n to each of its keys, for example due to an extra level of nesting that the original\n pre-trained weights from ImageNet won't contain. Fo...
def strip_prefix_if_present(state_dict, prefix): keys = sorted(state_dict.keys()) if (not all((key.startswith(prefix) for key in keys))): return state_dict stripped_state_dict = OrderedDict() for (key, value) in state_dict.items(): stripped_state_dict[key.replace(prefix, '')] = value ...
def load_state_dict(model, loaded_state_dict, no_head): model_state_dict = model.state_dict() loaded_state_dict = strip_prefix_if_present(loaded_state_dict, prefix='module.') align_and_update_state_dicts(model_state_dict, loaded_state_dict, no_head) model.load_state_dict(model_state_dict)
def set_seed(seed, rank, world_size): rng = random.Random(seed) seed_per_rank = [rng.randint(0, ((2 ** 32) - 1)) for _ in range(world_size)] cur_seed = seed_per_rank[rank] random.seed(cur_seed) torch.manual_seed(cur_seed) torch.cuda.manual_seed(cur_seed) np.random.seed(cur_seed)
def _register_generic(module_dict, module_name, module): assert (module_name not in module_dict) module_dict[module_name] = module
class Registry(dict): '\n A helper class for managing registering modules, it extends a dictionary\n and provides a register functions.\n\n Eg. creeting a registry:\n some_registry = Registry({"default": default_module})\n\n There\'re two ways of registering new modules:\n 1): normal way is ...
def av_decode_video(video_path): with av.open(video_path) as container: frames = [] for frame in container.decode(video=0): frames.append(frame.to_rgb().to_ndarray()) return frames
def cv2_decode_video(video_path): frames = [] for frame in container.decode(video=0): frames.append(frame.to_rgb().to_ndarray()) return frames
def image_decode(video_path): frames = [] try: with Image.open(video_path) as img: frames.append(np.array(img.convert('RGB'))) except BaseException as e: raise RuntimeError('Caught "{}" when loading {}'.format(str(e), video_path)) return frames
def csv2COCOJson(csv_path, movie_list, img_root, json_path, min_json_path): ann_df = pd.read_csv(csv_path, header=None) movie_ids = {} with open(movie_list) as movief: for (idx, line) in enumerate(movief): name = line[:line.find('.')] movie_ids[name] = idx movie_infos =...
def genCOCOJson(movie_list, img_root, json_path, min_json_path): movie_ids = {} with open(movie_list) as movief: for (idx, line) in enumerate(movief): name = line[:line.find('.')] movie_ids[name] = idx movie_infos = {} for movie_name in tqdm(movie_ids): movie_in...
def main(): parser = argparse.ArgumentParser(description='Generate coco format json for AVA.') parser.add_argument('--csv_path', default='', help='path to csv file', type=str) parser.add_argument('--movie_list', required=True, help='path to movie list', type=str) parser.add_argument('--img_root', requ...
def slice_movie_yuv(movie_path, clip_root, midframe_root='', start_sec=895, end_sec=1805, targ_fps=30, targ_size=360): probe_args = ['ffprobe', '-show_format', '-show_streams', '-of', 'json', movie_path] p = subprocess.Popen(probe_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (out, err) = p.commun...
def multiprocess_wrapper(args): (args, kwargs) = args return slice_movie_yuv(*args, **kwargs)
def main(): parser = argparse.ArgumentParser(description='Script for processing AVA videos.') parser.add_argument('--movie_root', required=True, help='root directory of downloaded movies', type=str) parser.add_argument('--clip_root', required=True, help='root directory to store segmented video clips', typ...
def make_cython_ext(name, module, sources): extra_compile_args = None if (platform.system() != 'Windows'): extra_compile_args = {'cxx': ['-Wno-unused-function', '-Wno-write-strings']} extension = Extension('{}.{}'.format(module, name), [os.path.join(*module.split('.'), p) for p in sources], includ...
def make_cuda_ext(name, module, sources): return CUDAExtension(name='{}.{}'.format(module, name), sources=[os.path.join(*module.split('.'), p) for p in sources], extra_compile_args={'cxx': [], 'nvcc': ['-D__CUDA_NO_HALF_OPERATORS__', '-D__CUDA_NO_HALF_CONVERSIONS__', '-D__CUDA_NO_HALF2_OPERATORS__']})
def get_extensions(): this_dir = os.path.dirname(os.path.abspath(__file__)) extensions_dir = os.path.join(this_dir, 'hit/csrc') main_file = glob.glob(os.path.join(extensions_dir, '*.cpp')) source_cpu = glob.glob(os.path.join(extensions_dir, 'cpu', '*.cpp')) source_cuda = glob.glob(os.path.join(ext...
def main(): parser = argparse.ArgumentParser(description='PyTorch Object Detection Inference') parser.add_argument('--config-file', default='config_files/hitnet.yaml', metavar='FILE', help='path to config file') parser.add_argument('--local_rank', type=int, default=0) parser.add_argument('opts', help=...
def train(cfg, local_rank, distributed, tblogger=None, transfer_weight=False, adjust_lr=False, skip_val=False, no_head=False): model = build_detection_model(cfg) device = torch.device('cuda') model.to(device) optimizer = make_optimizer(cfg, model) scheduler = make_lr_scheduler(cfg, optimizer) ...
def run_test(cfg, model, distributed): if distributed: model = model.module torch.cuda.empty_cache() output_folders = ([None] * len(cfg.DATASETS.TEST)) dataset_names = cfg.DATASETS.TEST if cfg.OUTPUT_DIR: for (idx, dataset_name) in enumerate(dataset_names): output_folde...
def main(): parser = argparse.ArgumentParser(description='PyTorch Action Detection Training') parser.add_argument('--config-file', default='config_files/hitnet.yaml', metavar='FILE', help='path to config file', type=str) parser.add_argument('--local_rank', type=int, default=0) parser.add_argument('--s...
def read_acclog(log_dir, log_name): with open(os.path.join(log_dir, log_name), 'r') as f: lines = f.readlines() lines = [x.strip() for x in lines] acc_list = [] epo_list = [] for i in range(len(lines)): epo_i = lines[i].split(' ')[0] acc_i = lines[i].split('(')[1] a...
def main(): global args args = parser.parse_args() log_dir = ('%s/%s/' % (args.work_dir, args.log_dir)) (acc1_list, epo1_list) = read_acclog(log_dir, log_name='val_acc1.txt') best_acc1 = np.max(acc1_list) best_idx1 = acc1_list.index(np.max(acc1_list)) best_epo1 = epo1_list[best_idx1] (...
def read_acclog(log_dir, log_name): with open(os.path.join(log_dir, log_name), 'r') as f: lines = f.readlines() lines = [x.strip() for x in lines] acc_list = [] epo_list = [] for i in range(len(lines)): epo_i = lines[i].split(' ')[0] acc_i = lines[i].split('(')[1] a...
def read_losslog(log_dir, log_name): with open(os.path.join(log_dir, log_name), 'r') as f: lines = f.readlines() lines = [x.strip() for x in lines] loss_list = [] epo_list = [] for i in range(len(lines)): epo_i = lines[i].split(' ')[0] loss_i = lines[i].split(' ')[(- 1)] ...
def plot_loss(loss, epochs, save_path, plot_name): plt.figure() plt.plot(epochs, loss, label='training') plt.title('Training loss') plt.ylabel('loss') plt.xlabel('epoch') plt.xlim(min(epochs), max(epochs)) plt.ylim(int(min(loss)), int(max(loss))) plt.yticks(range(int(min(loss)), int(ma...
def plot_acc(acc, val_acc, epochs, val_epochs, save_path, plot_name): plt.figure() plt.plot(epochs, acc, label='training') plt.plot(val_epochs, val_acc, label='validation') plt.title('Training and validation acc') plt.ylabel('acc') plt.xlabel('epoch') plt.xlim(min(epochs), max(epochs)) ...
def main(): global args args = parser.parse_args() log_dir = ('%s/%s/' % (args.work_dir, args.log_dir)) save_path = log_dir (acc1_list, epo1_list) = read_acclog(log_dir, log_name='train_acc1.txt') (val_acc1_list, val_epo1_list) = read_acclog(log_dir, log_name='val_acc1.txt') plot_acc(acc1_...
class SELayer(nn.Module): def __init__(self, channel, reduction=16): super(SELayer, self).__init__() self.avg_pool = nn.AdaptiveAvgPool2d(1) self.fc = nn.Sequential(nn.Linear(channel, (channel // reduction), bias=False), nn.ReLU(inplace=True), nn.Linear((channel // reduction), channel, bi...
class eca_layer(nn.Module): 'Constructs a ECA module.\n Args:\n channel: Number of channels of the input feature map\n k_size: Adaptive selection of kernel size\n source: https://github.com/BangguWu/ECANet\n ' def __init__(self, channel, k_size=3): super(eca_layer, self).__...
def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1): '3x3 convolution with padding' return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=dilation, groups=groups, bias=False, dilation=dilation)
def conv1x1(in_planes, out_planes, stride=1): '1x1 convolution' return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False)
class RLA_Bottleneck(nn.Module): expansion = 4 def __init__(self, inplanes, planes, stride=1, downsample=None, rla_channel=32, SE=False, ECA_size=None, groups=1, base_width=64, dilation=1, norm_layer=None, reduction=16): super(RLA_Bottleneck, self).__init__() if (norm_layer is None): ...
@BACKBONES.register_module() class RLA_ResNet(nn.Module): '\n rla_channel: the number of filters of the shared(recurrent) conv in RLA\n SE: whether use SE or not \n ECA: None: not use ECA, or specify a list of kernel sizes\n \n frozen_stages (int): Stages to be frozen (stop grad and set eval mode)....
class ConvGRUCell_layer(nn.Module): def __init__(self, input_channel, output_channel, kernel_size=3): super(ConvGRUCell_layer, self).__init__() gru_input_channel = (input_channel + output_channel) self.output_channel = output_channel self.kernel_size = kernel_size self.pad...
class ConvLSTMCell_layer(nn.Module): def __init__(self, input_dim, hidden_dim, kernel_size=(3, 3), bias=False): '\n Initialize ConvLSTM cell.\n Parameters\n ----------\n input_dim: int\n Number of channels of input tensor.\n hidden_dim: int\n Numbe...
class eca_layer(nn.Module): 'Constructs a ECA module.\n Args:\n channel: Number of channels of the input feature map\n k_size: Adaptive selection of kernel size\n source: https://github.com/BangguWu/ECANet\n ' def __init__(self, channel, k_size=3): super(eca_layer, self).__...
def _make_divisible(v: float, divisor: int, min_value: Optional[int]=None) -> int: '\n This function is taken from the original tf repo.\n It ensures that all layers have a channel number that is divisible by 8\n It can be seen here:\n https://github.com/tensorflow/models/blob/master/research/slim/net...
class ConvBNReLU(nn.Sequential): def __init__(self, in_planes: int, out_planes: int, kernel_size: int=3, stride: int=1, groups: int=1, norm_layer: Optional[Callable[(..., nn.Module)]]=None) -> None: padding = ((kernel_size - 1) // 2) if (norm_layer is None): norm_layer = nn.BatchNorm2...
class InvertedResidual(nn.Module): def __init__(self, inp: int, oup: int, stride: int, expand_ratio: int, norm_layer: Optional[Callable[(..., nn.Module)]]=None, ECA_ksize=None) -> None: super(InvertedResidual, self).__init__() self.stride = stride assert (stride in [1, 2]) if (nor...
class MobileNetV2(nn.Module): def __init__(self, num_classes: int=1000, width_mult: float=1.0, inverted_residual_setting: Optional[List[List[int]]]=None, round_nearest: int=8, block: Optional[Callable[(..., nn.Module)]]=None, norm_layer: Optional[Callable[(..., nn.Module)]]=None, ECA=False) -> None: '\n ...
def mobilenet_v2(**kwargs: Any) -> MobileNetV2: '\n Constructs a MobileNetV2 architecture from\n `"MobileNetV2: Inverted Residuals and Linear Bottlenecks" <https://arxiv.org/abs/1801.04381>`_.\n ' print('Constructing mobilenetv2......') model = MobileNetV2(**kwargs) return model
def mobilenetv2_eca(eca=True): '\n default: \n ECA=False\n ' print('Constructing mobilenetv2_eca......') model = MobileNetV2(ECA=eca) return model
def conv_out(in_planes, out_planes): '1x1 convolution' return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=1, bias=False)
def recurrent_dsconv(in_planes, out_planes, groups): '3x3 deepwise separable convolution with padding' return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=1, padding=1, groups=groups, bias=False)
def _make_divisible(v: float, divisor: int, min_value: Optional[int]=None) -> int: '\n This function is taken from the original tf repo.\n It ensures that all layers have a channel number that is divisible by 8\n It can be seen here:\n https://github.com/tensorflow/models/blob/master/research/slim/net...
class ConvBNReLU(nn.Sequential): def __init__(self, in_planes: int, out_planes: int, kernel_size: int=3, stride: int=1, groups: int=1, norm_layer: Optional[Callable[(..., nn.Module)]]=None) -> None: padding = ((kernel_size - 1) // 2) if (norm_layer is None): norm_layer = nn.BatchNorm2...
class InvertedResidual(nn.Module): def __init__(self, inp: int, oup: int, stride: int, expand_ratio: int, rla_channel: int, norm_layer: Optional[Callable[(..., nn.Module)]]=None, ECA_ksize=None) -> None: super(InvertedResidual, self).__init__() self.stride = stride assert (stride in [1, 2...
class dsRLA_MobileNetV2(nn.Module): def __init__(self, num_classes: int=1000, width_mult: float=1.0, rla_channel: int=32, inverted_residual_setting: Optional[List[List[int]]]=None, round_nearest: int=8, block: Optional[Callable[(..., nn.Module)]]=None, norm_layer: Optional[Callable[(..., nn.Module)]]=None, ECA=F...
def dsrla_mobilenetv2(rla_channel=32): ' Constructs a RLA_MobileNetV2 model.\n default: \n rla_channel = 32, ECA=False\n ' print('Constructing dsrla_mobilenetv2......') model = dsRLA_MobileNetV2(rla_channel=rla_channel) return model
def dsrla_mobilenetv2_eca(rla_channel=32, eca=True): ' Constructs a RLA_MobileNetV2 model.\n default: \n rla_channel = 32, ECA=False\n ' print('Constructing dsrla_mobilenetv2_eca......') model = dsRLA_MobileNetV2(rla_channel=rla_channel, ECA=eca) return model
def dsrla_mobilenetv2_k6(): ' Constructs a RLA_MobileNetV2 model.\n default: \n rla_channel = 32, ECA=False\n ' print('Constructing dsrla_mobilenetv2_k6......') model = dsRLA_MobileNetV2(rla_channel=6) return model
def dsrla_mobilenetv2_k6_eca(eca=True): ' Constructs a RLA_MobileNetV2 model.\n default: \n rla_channel = 32, ECA=False\n ' print('Constructing dsrla_mobilenetv2_k6_eca......') model = dsRLA_MobileNetV2(rla_channel=6, ECA=eca) return model
def dsrla_mobilenetv2_k12(): ' Constructs a RLA_MobileNetV2 model.\n default: \n rla_channel = 32, ECA=False\n ' print('Constructing dsrla_mobilenetv2_k12......') model = dsRLA_MobileNetV2(rla_channel=12) return model
def dsrla_mobilenetv2_k12_eca(eca=True): ' Constructs a RLA_MobileNetV2 model.\n default: \n rla_channel = 32, ECA=False\n ' print('Constructing dsrla_mobilenetv2_k12_eca......') model = dsRLA_MobileNetV2(rla_channel=12, ECA=eca) return model
def dsrla_mobilenetv2_k24(): ' Constructs a RLA_MobileNetV2 model.\n default: \n rla_channel = 32, ECA=False\n ' print('Constructing dsrla_mobilenetv2_k24......') model = dsRLA_MobileNetV2(rla_channel=24) return model
def dsrla_mobilenetv2_k24_eca(eca=True): ' Constructs a RLA_MobileNetV2 model.\n default: \n rla_channel = 32, ECA=False\n ' print('Constructing dsrla_mobilenetv2_k24_eca......') model = dsRLA_MobileNetV2(rla_channel=24, ECA=eca) return model
def dsrla_mobilenetv2_k32(): ' Constructs a RLA_MobileNetV2 model.\n default: \n rla_channel = 32, ECA=False\n ' print('Constructing dsrla_mobilenetv2_k32......') model = dsRLA_MobileNetV2(rla_channel=32) return model
def dsrla_mobilenetv2_k32_eca(eca=True): ' Constructs a RLA_MobileNetV2 model.\n default: \n rla_channel = 32, ECA=False\n ' print('Constructing dsrla_mobilenetv2_k32_eca......') model = dsRLA_MobileNetV2(rla_channel=32, ECA=eca) return model