mobilenet_v3_224

深度学习识别手势 【代码】深度学习识别手势。 阅读详情
"""MobileNet v3 models for Keras.
The following table describes the performance of MobileNets:
------------------------------------------------------------------------
MACs stands for Multiply Adds
| Classification Checkpoint| MACs (M)| Parameters (M)| Top 1 Accuracy| Pixel 1 CPU (ms)|
| [mobilenet_v3_large_1.0_224]              | 217 | 5.4 | 75.2 | 51.2 |
| [mobilenet_v3_large_0.75_224]             | 155 | 4.0 | 73.3 | 39.8 |
| [mobilenet_v3_large_minimalistic_1.0_224] | 209 | 3.9 | 72.3 | 44.1 |
| [mobilenet_v3_small_1.0_224]              | 66  | 2.9 | 67.5 | 15.8 |
| [mobilenet_v3_small_0.75_224]             | 44  | 2.4 | 65.4 | 12.8 |
| [mobilenet_v3_small_minimalistic_1.0_224] | 65  | 2.0 | 61.9 | 12.2 |
The weights for all 6 models are obtained and
translated from the Tensorflow checkpoints
from TensorFlow checkpoints found [here]
(https://github.com/tensorflow/models/tree/master/research/slim/nets/mobilenet/README.md).
# Reference
This file contains building code for MobileNetV3, based on
[Searching for MobileNetV3]
(https://arxiv.org/pdf/1905.02244.pdf) (ICCV 2019)
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import os
import warnings

from . import get_submodules_from_kwargs
from .imagenet_utils import decode_predictions
from .imagenet_utils import _obtain_input_shape

BASE_WEIGHT_PATH = ('https://github.com/DrSlink/mobilenet_v3_keras/releases/download/v1.0/')

backend = None
layers = None
models = None
keras_utils = None


def preprocess_input(x, **kwargs):
    """Preprocesses a numpy array encoding a batch of images.
    # Arguments
        x: a 4D numpy array consists of RGB values within [0, 255].
    # Returns
        Preprocessed array.
    """
    return imagenet_utils.preprocess_input(x, mode='tf', **kwargs)


def hard_sigmoid(x):
    return layers.ReLU(6.)(x + 3.) * (1. / 6.)


def hard_swish(x):
    return layers.Multiply()([layers.Activation(hard_sigmoid)(x), x])


def _activation(x, name='relu'):
    if name == 'relu':
        return layers.ReLU()(x)
    elif name == 'hardswish':
        return hard_swish(x)


# This function is taken from the original tf repo.
# It ensures that all layers have a channel number that is divisible by 8
# It can be seen here:
# https://github.com/tensorflow/models/blob/master/research/slim/nets/mobilenet/mobilenet.py


def _make_divisible(v, divisor, min_value=None):
    if min_value is None:
        min_value = divisor
    new_v = max(min_value, int(v + divisor / 2) // divisor * divisor)
    # Make sure that round down does not go down by more than 10%.
    if new_v < 0.9 * v:
        new_v += divisor
    return new_v


def MobileNetV3(input_shape=None,
                alpha=1.0,
                model_type='small',
                minimalistic=False,
                include_top=True,
                weights='imagenet',
                input_tensor=None,
                classes=1000,
                dropout=0.2,
                regularizer=None,
                **kwargs):
    """Instantiates the MobileNetV3 architecture.
        # Arguments
            input_shape: optional shape tuple, to be specified if you would
                like to use a model with an input img resolution that is not
                (224, 224, 3).
                It should have exactly 3 inputs channels (224, 224, 3).
                You can also omit this option if you would like
                to infer input_shape from an input_tensor.
                If you choose to include both input_tensor and input_shape then
                input_shape will be used if they match, if the shapes
                do not match then we will throw an error.
                E.g. `(160, 160, 3)` would be one valid value.
            alpha: controls the width of the network. This is known as the
                depth multiplier in the MobileNetV3 paper, but the name is kept for
                consistency with MobileNetV1 in Keras.
                - If `alpha` < 1.0, proportionally decreases the number
                    of filters in each layer.
                - If `alpha` > 1.0, proportionally increases the number
                    of filters in each layer.
                - If `alpha` = 1, default number of filters from the paper
                    are used at each layer.
            model_type: MobileNetV3 is defined as two models: large and small.
                These models are targeted at high and low resource use cases respectively.
            minimalistic: In addition to large and small models this module also contains
                so-called minimalistic models, these models have the same per-layer dimensions
                characteristic as MobilenetV3 however, they don't utilize any of the advanced blocks
                (squeeze-and-excite units, hard-swish, and 5x5 convolutions). While these models are
                less efficient on CPU, we find that they are much more performant on GPU/DSP.
            include_top: whether to include the fully-connected
                layer at the top of the network.
            weights: one of `None` (random initialization),
                  'imagenet' (pre-training on ImageNet),
                  or the path to the weights file to be loaded.
            input_tensor: optional Keras tensor (i.e. output of
                `layers.Input()`)
                to use as image input for the model.
            classes: optional number of classes to classify images
                into, only to be specified if `include_top` is True, and
                if no `weights` argument is specified.
            dropout: fraction of the input units to drop on the last layer
            regularizer: wich regularizer to use on each conv2d layer (in paper was l2(1e-5))
        # Returns
            A Keras model instance.
        # Raises
            ValueError: in case of invalid model type, argument for `weights`,
                or invalid input shape when weights='imagenet'
        """
    global backend, layers, models, keras_utils
    backend, layers, models, keras_utils = get_submodules_from_kwargs(kwargs)

    if not (weights in {'imagenet', None} or os.path.exists(weights)):
        raise ValueError('The `weights` argument should be either '
                         '`None` (random initialization), `imagenet` '
                         '(pre-training on ImageNet), '
                         'or the path to the weights file to be loaded.')

    if weights == 'imagenet' and include_top and classes != 1000:
        raise ValueError('If using `weights` as `"imagenet"` with `include_top` '
                         'as true, `classes` should be 1000')

    # Determine proper input shape and default size.
    # If both input_shape and input_tensor are used, they should match
    if input_shape is not None and input_tensor is not None:
        try:
            is_input_t_tensor = backend.is_keras_tensor(input_tensor)
        except ValueError:
            try:
                is_input_t_tensor = backend.is_keras_tensor(
                    keras_utils.get_source_inputs(input_tensor))
            except ValueError:
                raise ValueError('input_tensor: ', input_tensor,
                                 'is not type input_tensor')
        if is_input_t_tensor:
            if backend.image_data_format == 'channels_first':
                if backend.int_shape(input_tensor)[1] != input_shape[1]:
                    raise ValueError('input_shape: ', input_shape,
                                     'and input_tensor: ', input_tensor,
                                     'do not meet the same shape requirements')
            else:
                if backend.int_shape(input_tensor)[2] != input_shape[1]:
                    raise ValueError('input_shape: ', input_shape,
                                     'and input_tensor: ', input_tensor,
                                     'do not meet the same shape requirements')
        else:
            raise ValueError('input_tensor specified: ', input_tensor,
                             'is not a keras tensor')

    # If input_shape is None, infer shape from input_tensor
    if input_shape is None and input_tensor is not None:

        try:
            backend.is_keras_tensor(input_tensor)
        except ValueError:
            raise ValueError('input_tensor: ', input_tensor,
                             'is type: ', type(input_tensor),
                             'which is not a valid type')

        if backend.is_keras_tensor(input_tensor):
            if backend.image_data_format() == 'channels_first':
                rows = backend.int_shape(input_tensor)[2]
                cols = backend.int_shape(input_tensor)[3]
                input_shape = (3, cols, rows)
            else:
                rows = backend.int_shape(input_tensor)[1]
                cols = backend.int_shape(input_tensor)[2]
                input_shape = (cols, rows, 3)

    if backend.image_data_format() == 'channels_last':
        row_axis, col_axis = (0, 1)
    else:
        row_axis, col_axis = (1, 2)
    rows = input_shape[row_axis]
    cols = input_shape[col_axis]
    if rows < 32 or cols < 32:
        raise ValueError('Input size must be at least 32x32; got `input_shape=' +
                         str(input_shape) + '`')
    if weights == 'imagenet':
        if minimalistic == False and alpha not in [0.75, 1.0] or minimalistic == True and alpha != 1.0:
            raise ValueError('If imagenet weights are being loaded, '
                             'alpha can be one of `0.75`, `1.0` for non minimalistic or `1.0` for minimalistic only.')

        if rows != cols or rows != 224:
            warnings.warn('`input_shape` is undefined or non-square, '
                          'or `rows` is not 224.'
                          ' Weights for input shape (224, 224) will be'
                          ' loaded as the default.')

    if input_tensor is None:
        img_input = layers.Input(shape=input_shape)
    else:
        if not backend.is_keras_tensor(input_tensor):
            img_input = layers.Input(tensor=input_tensor, shape=input_shape)
        else:
            img_input = input_tensor

    channel_axis = 1 if backend.image_data_format() == 'channels_first' else -1

    if minimalistic:
        kernel = 3
        activation = 'relu'
        se_ratio = None
    else:
        kernel = 5
        activation = 'hardswish'
        se_ratio = 0.25

    x = layers.Conv2D(16,
                      kernel_size=3,
                      strides=(2, 2),
                      padding='same',
                      kernel_regularizer=regularizer,
                      use_bias=False,
                      name='Conv')(img_input)
    x = layers.BatchNormalization(axis=channel_axis,
                                  name='Conv/BatchNorm')(x)
    x = _activation(x, name=activation)

    if model_type == 'small':
        #   (inputs, expansion, alpha, out_ch, kernel_size, stride, se_ratio, activation, regularizer, block_id)
        x = _inverted_res_block(x, 1, 16, alpha, 3, 2, se_ratio, 'relu', regularizer, 0)
        x = _inverted_res_block(x, 4.5, 24, alpha, 3, 2, None, 'relu', regularizer, 1)
        x = _inverted_res_block(x, 3.66, 24, alpha, 3, 1, None, 'relu', regularizer, 2)
        x = _inverted_res_block(x, 4, 40, alpha, kernel, 2, se_ratio, activation, regularizer, 3)
        x = _inverted_res_block(x, 6, 40, alpha, kernel, 1, se_ratio, activation, regularizer, 4)
        x = _inverted_res_block(x, 6, 40, alpha, kernel, 1, se_ratio, activation, regularizer, 5)
        x = _inverted_res_block(x, 3, 48, alpha, kernel, 1, se_ratio, activation, regularizer, 6)
        x = _inverted_res_block(x, 3, 48, alpha, kernel, 1, se_ratio, activation, regularizer, 7)
        x = _inverted_res_block(x, 6, 96, alpha, kernel, 2, se_ratio, activation, regularizer, 8)
        x = _inverted_res_block(x, 6, 96, alpha, kernel, 1, se_ratio, activation, regularizer, 9)
        x = _inverted_res_block(x, 6, 96, alpha, kernel, 1, se_ratio, activation, regularizer, 10)
        last_conv_ch = _make_divisible(576 * alpha, 8)
        last_point_ch = 1024
    elif model_type == 'large':
        x = _inverted_res_block(x, 1, 16, alpha, 3, 1, None, 'relu', regularizer, 0)
        x = _inverted_res_block(x, 4, 24, alpha, 3, 2, None, 'relu', regularizer, 1)
        x = _inverted_res_block(x, 3, 24, alpha, 3, 1, None, 'relu', regularizer, 2)
        x = _inverted_res_block(x, 3, 40, alpha, kernel, 2, se_ratio, 'relu', regularizer, 3)
        x = _inverted_res_block(x, 3, 40, alpha, kernel, 1, se_ratio, 'relu', regularizer, 4)
        x = _inverted_res_block(x, 3, 40, alpha, kernel, 1, se_ratio, 'relu', regularizer, 5)
        x = _inverted_res_block(x, 6, 80, alpha, 3, 2, None, activation, regularizer, 6)
        x = _inverted_res_block(x, 2.5, 80, alpha, 3, 1, None, activation, regularizer, 7)
        x = _inverted_res_block(x, 2.3, 80, alpha, 3, 1, None, activation, regularizer, 8)
        x = _inverted_res_block(x, 2.3, 80, alpha, 3, 1, None, activation, regularizer, 9)
        x = _inverted_res_block(x, 6, 112, alpha, 3, 1, se_ratio, activation, regularizer, 10)
        x = _inverted_res_block(x, 6, 112, alpha, 3, 1, se_ratio, activation, regularizer, 11)
        x = _inverted_res_block(x, 6, 160, alpha, kernel, 2, se_ratio, activation, regularizer, 12)
        x = _inverted_res_block(x, 6, 160, alpha, kernel, 1, se_ratio, activation, regularizer, 13)
        x = _inverted_res_block(x, 6, 160, alpha, kernel, 1, se_ratio, activation, regularizer, 14)
        last_conv_ch = _make_divisible(960 * alpha, 8)
        last_point_ch = 1280
    else:
        raise ValueError('Invalid model type')

    # if the width multiplier is greater than 1 we
    # increase the number of output channels
    if alpha > 1.0:
        last_point_ch = _make_divisible(last_point_ch * alpha, 8)

    x = layers.Conv2D(last_conv_ch,
                      kernel_size=1,
                      strides=1,
                      padding='same',
                      kernel_regularizer=regularizer,
                      use_bias=False,
                      name='Conv_1')(x)
    x = layers.BatchNormalization(axis=channel_axis,
                                  name='Conv_1/BatchNorm')(x)
    x = _activation(x, name=activation)

    # AvgPool2D is optimized in TFLite unlike GlobalAveragePooling2D
    x = layers.AvgPool2D(pool_size=(int(x.shape[1]), int(x.shape[2])))(x)
    x = layers.Conv2D(last_point_ch,
                      kernel_size=1,
                      padding='same',
                      kernel_regularizer=regularizer,
                      bias_regularizer=regularizer,
                      name='Conv_2')(x)
    x = _activation(x, name=activation)
    x = layers.Dropout(dropout)(x)

    if include_top:
        x = layers.Conv2D(classes,
                          kernel_size=1,
                          padding='same',
                          use_bias=True,
                          kernel_regularizer=regularizer,
                          bias_regularizer=regularizer,
                          name='Logits')(x)
        x = layers.Flatten()(x)
        x = layers.Softmax(name='Predictions/Softmax')(x)

    # Ensure that the model takes into account
    # any potential predecessors of `input_tensor`.
    if input_tensor is not None:
        inputs = keras_utils.get_source_inputs(input_tensor)
    else:
        inputs = img_input

    # Create model.
    model = models.Model(inputs, x, name='MobilenetV3')

    # Load weights.
    if weights == 'imagenet':
        model_name = 'weights_mobilenet_v3_' + model_type
        if minimalistic:
            model_name += '_minimalistic'
        model_name += '_224_' + str(alpha) + '_float'
        if not include_top:
            model_name += '_no_top'
        model_name += '.h5'
        weight_path = BASE_WEIGHT_PATH + model_name
        weights_path = keras_utils.get_file(model_name, weight_path, cache_subdir='models')
        print(weights_path)
        model.load_weights(weights_path)
    elif weights is not None:
        model.load_weights(weights)

    return model


def _inverted_res_block(inputs, expansion, alpha, out_ch, kernel_size, stride, se_ratio, activation, regularizer,
                        block_id):
    channel_axis = 1 if backend.image_data_format() == 'channels_first' else -1

    in_channels = backend.int_shape(inputs)[channel_axis]
    out_channels = _make_divisible(out_ch * alpha, 8)
    exp_size = _make_divisible(in_channels * expansion, 8)
    x = inputs
    prefix = 'expanded_conv/'
    if block_id:
        # Expand
        prefix = 'expanded_conv_{}/'.format(block_id)
        x = layers.Conv2D(exp_size,
                          kernel_size=1,
                          padding='same',
                          kernel_regularizer=regularizer,
                          use_bias=False,
                          name=prefix + 'expand')(x)
        x = layers.BatchNormalization(axis=channel_axis,
                                      name=prefix + 'expand/BatchNorm')(x)
        x = _activation(x, activation)

    x = layers.DepthwiseConv2D(kernel_size,
                               strides=stride,
                               padding='same',
                               dilation_rate=1,
                               depthwise_regularizer=regularizer,
                               use_bias=False,
                               name=prefix + 'depthwise')(x)
    x = layers.BatchNormalization(axis=channel_axis,
                                  name=prefix + 'depthwise/BatchNorm')(x)
    x = _activation(x, activation)

    if se_ratio:
        reduced_ch = _make_divisible(exp_size * se_ratio, 8)
        y = layers.AvgPool2D(pool_size=(int(x.shape[1]), int(x.shape[2])),
                             name=prefix + 'squeeze_excite/AvgPool')(x)
        y = layers.Conv2D(reduced_ch,
                          kernel_size=1,
                          padding='same',
                          kernel_regularizer=regularizer,
                          use_bias=True,
                          name=prefix + 'squeeze_excite/Conv')(y)
        y = layers.ReLU(name=prefix + 'squeeze_excite/Relu')(y)
        y = layers.Conv2D(exp_size,
                          kernel_size=1,
                          padding='same',
                          kernel_regularizer=regularizer,
                          use_bias=True,
                          name=prefix + 'squeeze_excite/Conv_1')(y)
        x = layers.Multiply(name=prefix + 'squeeze_excite/Mul')([layers.Activation(hard_sigmoid)(y), x])

    x = layers.Conv2D(out_channels,
                      kernel_size=1,
                      padding='same',
                      kernel_regularizer=regularizer,
                      use_bias=False,
                      name=prefix + 'project')(x)
    x = layers.BatchNormalization(axis=channel_axis,
                                  name=prefix + 'project/BatchNorm')(x)

    if in_channels == out_channels and stride == 1:
        x = layers.Add(name=prefix + 'Add')([inputs, x])
    return x
【使用自己的数据集】MobileNet V3 模型准备与模型训练 MobileNetV3是一个轻量级图像分类模型,其架构包含起始卷积层、中间MobileBlock模块和最终分类层。模型采用通道分离卷积和SE注意力机制实现高效计算,支持Large和Small两种配置。实验使用板球/足球/棒球数据集,通过固定输入尺寸(400×400)、冻结预训练参数和微调全连接层进行训练。结果显示该模型在保持精度的同时具有较高的推理速度,适用于移动端部署。推理阶段通过加载训练好的模型对输入图片进行分类预测。 阅读详情

相关推荐

MobileNet家族:从v1到v4的架构演进与发展历程

MobileNet 是一个为移动和嵌入式设备设计的轻量化卷积神经网络家族,从 v1(2017)到 v4(2024)不断演进。v1 引入深度可分离卷积,显著提升效率。v2(2018)采用倒置残差和线性瓶颈,进一步优化性能。v3(2019)通过神经架构搜索和 h-swish 激活,提供 Large 和 Small 变体,适配不同场景。v4(2024)引入通用倒置瓶颈和移动优化注意力机制,针对多硬件优化,强调通用性。各版本在效率与准确性间持续改进,广泛应用于实时视觉任务,未来有望进一步支持边缘计算需求。

彩旗工作室的博客 3309

【Tensorflow2.0】11、经典图像CNN模型实现代码

文章目录1.Lenet52.AlexNet3.VGG4. Inception系列(v1到v4)4.1 Inceptionv1(GoogLeNet)4.2 inceptionv24.3 inceptionv34.4 InceptionV45.ResNet5.1 ResNet V15.2 Resnet V26.ResNeXt7.Densenet8.Xception9 轻量级模型9.1 squeezen...

dddeee的专栏 2429

MobileNet V2 论文笔记

论文:Inverted Residuals and Linear Bottlenecks: Mobile Networks for Classification, Detection and Segmentation文章在residual net和MobileNet V1的基础上,提出MobileNet V2模型,一方面保证准确性,另一方面大幅的减少multiply-adds(MAdd)的计算量,从

西伯利亚的蓝眼睛 9174

TensorFlow 2.9的零零碎碎(四)-模型的输入

TensorFlow 2.9的零零碎碎(四)-模型的输入

天边一坨浮云 2408

23、OpenMV使用tensorflow 1.15.0训练模型mobilenet_v1_1.0_224进行车辆识别

基本思想:希望使用OpenMV调用Tensorflow 的tflite进行目标检测 一、下载window的Openmv的开发工具,软件下载 https://singtown.com/openmv/ 安装软件之后,进行链接和运行测试即可 测试的画面 帧率还是蛮快的 46.6321 46.6132 46.6284 46.6431 46.6249 46.6392 46.6216 46.6356 46.6185 46.6321 46.6156 46.6289 46.6418 46.6258.

sxj731533730 6008

【K210】 mobilenet_v1_0.75_224.kmodel V4部署到Maix go硬件

yys 2020.03.04 阅读本博客之前,请首先阅读“B20_04_facedetect.kmodel V4部署到Maix go硬件“。了解MaixPy_support_Kmodel V4.zip、nccase工具、kflash_gui、MaixPy IDE版本、模型部署等相关信息。 2.mobilenet_v1_0.75_224.kmodel模型 MaixPy_support_KmodelV4.zip解压文件夹下的mbnet75.tflite对应是mobilenet_v1_0.75_224..

jn10010537的博客 1825

Keras Flatten的input_shape问题

在fine tune Keras Applications中给出的分类CNN Model的时候,如果在Model的top层之上加入Flatten层就会出现错误。可能的报错信息类似下面的内容: $ python3 ./train.py Using TensorFlow backend. Found 60000 images belonging to 200 classes. Found 2000...

Monster_H7的博客 2901

7.5 使用MobileNet v3进行图像的区分

定义损失函数和优化器 criterion = nn.CrossEntropyLoss() optimizer = torch.optim.Adam(self.net.parameters(), lr=0.001)MobileNet v3-Small的网络结构如下,它的输入是224x224的3通道彩色图片。transforms.ToTensor(), # 转换成 0-1之间的数值。例如:BGR彩色图像 → (480, 640, 3)形状 (Shape):(高度, 宽度, 通道数)

qq_34047402的博客 308

keras中遇到的一些问题

keras中遇到的一些问题 AttributeError: ‘NoneType’ object has no attribute ‘image_data_format’ 根据报错找到: backend, _, _, _ = get_submodules_from_kwargs(kwargs) 跳转到get_submodules_from_kwargs函数,将backend的获取改为: backend = keras.backend 并导入keras: import keras AttributeErr

shimmer_ghq的博客 2332

mobilenet_1_0_224_tf_no_top.h5

MobileNet神经网络预训练权重文件 Linux下是放在“~/.keras/models/”中 Win下则放在Python的“settings/.keras/models/”中 Windows-weights路径:C:\Users\你的用户名\.keras\models anaconda下依然好用

大数据领域数据建模的多源数据融合技术

在大数据时代,数据来源呈现出多样化的特点,包括企业内部的不同业务系统数据、外部的社交媒体数据、传感器数据等。这些多源数据蕴含着丰富的信息,但由于数据格式、语义、质量等方面的差异,难以直接进行分析和利用。多源数据融合技术的目的就是将这些来自不同数据源的数据进行整合、清洗、关联和统一,构建一个具有一致性和完整性的数据模型,以便更好地挖掘数据背后的价值,为企业决策、科学研究等提供有力支持。

Java大师兄的博客 1305

PaddleHub 图像分类模块 mobilenet_v3_small_imagenet_ssld 使用指南:安装、API 预测与 Serving 部署

本文以 PaddleHub 仓库中的 [mobilenet_v3_small_imagenet_ssld 模块文档](https://link.gitcode.com/i/7ca143adacd439ae76b20780003f1b91) 为主体,系统讲解该轻量级图像分类模块的模型背景、环境安装、命令行预测、Python API 调用以及基于 PaddleHub Serving 的在线服务部署全流

gitblog_01115的博客 174

UsualToolCMS-验证码绕过漏洞复现

本文以UsualToolCMS为靶场,复现了验证码绕过漏洞

小小小屿屿屿的博客 918

mobilenetv4_conv_small.e1200_r224_in1k深度解析:为什么这个3.8M参数的模型如此高效

mobilenetv4_conv_small.e1200_r224_in1k是一款基于MobileNet-V4架构的图像分类模型,仅用3.8M参数就实现了高效的图像识别能力,非常适合移动端和嵌入式设备部署。 ## 🚀 超轻量模型的核心优势 ### 极致压缩的参数设计 该模型通过精心优化的网络结构,将参数量控制在3.8M(百万)级别,同时保持了74.29%的Top-1准确率和92.116%的T

gitblog_00281的博客 944

Unity3D移动平台简单实现

在电子游戏中移动平台可谓是十分常见的,如平台从一处至另一处的来回移动,或当需要玩家触发机关时,平台浮动并按一定的路线移动至目标处。本文主要是在Unity3D引擎下使用少量脚本实现两点之间来回移动平台的最基本功能,是一种比较简单且好理解的移动平台解决方案。 涉及到的点如下: 平台对象的实现 平台移动路线的设定 处于平台上游戏对象(如:玩家)的相对运动 创建平台控制对象 创建平台实...

长溪木可的博客 4683

oh-my-zsh详细安装与主题插件配置

使用Linux的小伙伴都知道默认shell是bash,但是对于喜欢折腾,喜欢酷炫的我们bash怎能够用。zsh的作为一种shell,功能更强大,但是配置复杂。后来,有大佬创建了一个名为oh-my-zsh的开源项目,使用方便,功能强大。 下面就去oh-my-zsh的配置。 ①安装zsh 想要安装oh-my-zsh,首先得安装zsh,输入命令 sudo apt-get install zsh 界面如下 ②查看是否安装成功 输入命令 zsh --version 可以查看安装zsh的版本..

惜洛-Jankin的博客 2万+

如何快速上手mobilenetv2_100.ra_in1k?3分钟实现图像分类

mobilenetv2_100.ra_in1k是一款基于MobileNet-v2架构的高效图像分类模型,通过timm库训练于ImageNet-1k数据集,特别采用了RandAugment数据增强技术和优化训练策略,适合新手快速实现图像分类任务。 ## 📋 模型核心特性速览 mobilenetv2_100.ra_in1k以轻量化设计著称,仅3.5M参数却能实现0.3 GMACs的计算效率,支持

gitblog_00493的博客 971

100天精通Python(可视化篇)——第89天:Bokeh库绘图可视化基础入门(参数说明+案例实战)

专栏导读 一、Bokeh是什么? 二、安装与导入 三、Bokeh接口介绍 四、创建图表 五、添加自定义渲染器 切换主题 添加图例 图例位置 图例方向 图例背景和边界 图例文本的外观 行列布局 网格布局

努力让自己发光,对的人才能迎着光而来 1万+

对MobileNet V1-V3的理解

可分离卷积分为:空间可分离卷积与深度可分离卷积 MobileNet用的是深度可分离卷积 深度可分离卷积: 深度可分离卷积=深度卷积(depthwise convolution)+逐点卷积(pointwise convolution) 一、MobileNet V1 详解 1. 设输入特征图是M维,卷积核是Dk * Dk,输出特征图是N维,大小是Dg * Dg 普通卷积: 计算量:Dk * Dk * M * N * Dg * Dg 计算量:5 * 5 * 3 * 256 * 8 * 8 ≈ 123W 深度卷.

方悔读书迟 5510

OTFS 消息传递算法信号检测【附matlab代码详解】

OTFS 消息传递算法方面的一些浅浅理解。

Cuby的博客 4010

YOLOv8 智能交通流量监测完整解决方案

YOLOv8智能交通流量监测系统基于先进的目标检测技术,提供实时车辆识别与统计分析功能。该系统通过虚拟检测线实现多方向车流量统计,支持多种车辆类型分类,并具备数据可视化、异常事件预警等核心功能。完整解决方案包含模型训练、实时检测、批量处理、结果分析等模块,并提供Flask API和Docker两种部署方案。系统采用YOLOv8算法实现高效检测,支持GPU加速,可通过量化、剪枝等技术进一步优化性能,为智能交通管理提供可靠的数据支持和技术保障。

u010117029的博客 117

Tensorflow Lite (TF Lite)demo 不支持 mobilenet_v1_1.0_224.tflite float 模型问题的解决

//Tensorflow 给的demo只支持 mobilenet_quant_v1_224.tflite 模型,如果换成其他模型如 mobilenet_v1_1.0_224.tflite 则会出现invalid interpreter handle之类的异常。这大概是调试最久的bug,从2018年12月份一直到2019年3月6日才算结束。之所以结束,是因为我把原来下载的模型删掉,重新下载了,结果...

遥感基础算法爱好者 7692

Unity 热更 之 【YooAsset 热更】几分钟快速了解 YooAsset [功能面板]、以及 [基础代码] 说明

Unity 的资源管理系统不断发展,以适应不同项目的需求和解决特定的问题。AssetBundle 和 Addressable Asset System 是 Unity 官方提供的资源管理解决方案,而 YooAsset 是第三方提供的资源管理系统。简化的API和易用性YooAsset 可能提供了更简单直观的 API,使得资源加载和管理更加容易。对于不熟悉 Addressable 或 AssetBundle 复杂配置的开发者来说,YooAsset 可能是一个更易于上手的选择。性能优化。

仙魁XAN 2955

Mobilenet v1-v3

作者认为,当前模型是基于 V2 模型中的倒残差结构和相应的变体(如下图)。使用1×1 卷积来构建最后层,这样可以便于拓展到更高维的特征空间。这样做的好处是,在预测时,有更多更丰富的特征来满足预测,但是同时也引入了额外的计算成本与延时。所以,需要改进的地方就是要保留高维特征的前提下减小延时。首先,还是将 1×1 层放在到最终平均池之后。这样的话最后一组特征现在不是 7x7(下图 V2 结构红框),而是以 1x1 计算(下图 V3 结构黄框)。这样的好处是,在计算和延迟方面,特征的计算几乎是免费的。

小白不白 1146

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

通俗易懂理解MobileNet网络模型

通俗易懂理解MobileNet网络模型

IT菜鸟 9890

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

MobileNet V1~V3

改为。

m0_51665742的博客 885

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain&#39;s apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath(&#39;DeepLearnToolbox&#39;));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand(&#39;state&#39;,0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W&#39;); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand(&#39;state&#39;,0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = &#39;sigm&#39;;%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, &#39;Too big error&#39;);```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand(&#39;state&#39;,0)sae = saesetup([784 100]);sae.ae{1}.activation_function = &#39;sigm&#39;;sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)&#39;)% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;;nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, &#39;Too big error&#39;);```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x&#39;,28,28,60000))/255;test_x = double(reshape(test_x&#39;,28,28,10000))/255;train_y = double(train_y&#39;);test_y = double(test_y&#39;);%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you&#39;ll get around 1.2% errorrand(&#39;state&#39;,0)cnn.layers = { struct(&#39;type&#39;, &#39;i&#39;) %input layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 6, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %sub sampling layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 12, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, &#39;Too big error&#39;);```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, &#39;Too big error&#39;);%% ex2 neural net with L2 weight decayrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex3 neural net with dropoutrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex4 neural net with sigmoid activation functionrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex5 plotting functionalityrand(&#39;state&#39;,0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = &#39;softmax&#39;; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand(&#39;state&#39;,0)nn = nnsetup([784 20 10]); nn.output = &#39;softmax&#39;; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

上一篇: mobilenet_v1
下一篇: mobilenet_v2
半棵树dd
博客等级 码龄7年 5粉丝 20原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值