官方代码 Deeplab v3+ resnet101 做backbone

article/2025/10/6 14:23:25

大年初一我居然在更博客。今年过年由于病毒横行,没有串门没有聚餐,整个人闲的没事干。。。医生真是不容易,忙得团团转还有生命危险,新希望他们平安。

本篇不属于初级教程。如果完全看不懂请自行谷歌或搜索作者博客。

deeplab官方提供了多种backbone,通过train.py中传递参数,

--model_variant="resnet_v1_101_beta" \

可以更改backbone。(resnet_v1_{50,101}_beta: We modify the original ResNet-101 [10], similar to PSPNet [11] by replacing the first 7x7 convolution with three 3x3 convolutions. See resnet_v1_beta.py for more details.)

这个是官方对beta的说法。就是改了一个卷积核的尺寸。改小了,并且用了三个。

一共有如下可选:

# A map from feature extractor name to the network name scope used in the
# ImageNet pretrained versions of these models.
name_scope = {'mobilenet_v2': 'MobilenetV2','resnet_v1_50': 'resnet_v1_50','resnet_v1_50_beta': 'resnet_v1_50','resnet_v1_101': 'resnet_v1_101','resnet_v1_101_beta': 'resnet_v1_101','xception_41': 'xception_41','xception_65': 'xception_65','xception_71': 'xception_71','nas_pnasnet': 'pnasnet','nas_hnasnet': 'hnasnet',
}

当然backbone更改后,网络训练的参数比如decay什么的也有所不同。在feature_extractor.py中307行开始就是在改参数,举个例子:

  if 'resnet' in model_variant:arg_scope = arg_scopes_map[model_variant](weight_decay=weight_decay,batch_norm_decay=0.95,batch_norm_epsilon=1e-5,batch_norm_scale=True)

并且在train.py中:

# For weight_decay, use 0.00004 for MobileNet-V2 or Xcpetion model variants.
# Use 0.0001 for ResNet model variants.
flags.DEFINE_float('weight_decay', 0.00004,'The value of the weight decay for training.')

所以,在我自己的bash文件中,我也要改

--weight_decay=0.0001 \

于是我完整的bash文件就是:

python "${WORK_DIR}"/train.py \--logtostderr \--train_split="train" \--model_variant="resnet_v1_50_beta" \--weight_decay=0.0001 \--atrous_rates=6 \--atrous_rates=12 \--atrous_rates=18 \--output_stride=16 \--decoder_output_stride=4 \--train_crop_size="513,513" \--train_batch_size=12 \--num_clones=6 \--training_number_of_steps=30000 \--fine_tune_batch_norm=True \--train_logdir="${TRAIN_LOGDIR}" \--dataset_dir="${PASCAL_DATASET}" \--tf_initial_checkpoint="${RES_WEIGHT}" \--base_learning_rate=0.007 \

说完了命令再说一下权重,官方给了resnet101,以及resnet50在imagenet,(https://github.com/tensorflow/models/blob/master/research/deeplab/g3doc/model_zoo.md)resnet预训练的权重。从官网下载后,加载的过程中,我发现,如果使用

--model_variant="resnet_v1_101" \

会出现加载错误。网络结构中在bottleneck上的参数设置,与checkpoint训练的网络结构不一样。同时,resnet在论文中提及的时候,作者说自己改过了。所以,这里大年初一更博客的笔者推测,beta版本才是真正的backbone。由于谷歌上不去,不想用镜像,所以笔者使用的是beta。使用后权重加载成功,并且有如下提示:


INFO:tensorflow:Initializing model from path: /home/DATA/liutian/tmp/tfdeeplab/resnet/model.ckpt
WARNING:tensorflow:Checkpoint is missing variable [image_pooling/weights]
WARNING:tensorflow:Checkpoint is missing variable [image_pooling/BatchNorm/gamma]
WARNING:tensorflow:Checkpoint is missing variable [image_pooling/BatchNorm/beta]
WARNING:tensorflow:Checkpoint is missing variable [image_pooling/BatchNorm/moving_mean]
WARNING:tensorflow:Checkpoint is missing variable [image_pooling/BatchNorm/moving_variance]
WARNING:tensorflow:Checkpoint is missing variable [aspp0/weights]
WARNING:tensorflow:Checkpoint is missing variable [aspp0/BatchNorm/gamma]
WARNING:tensorflow:Checkpoint is missing variable [aspp0/BatchNorm/beta]
WARNING:tensorflow:Checkpoint is missing variable [aspp0/BatchNorm/moving_mean]
WARNING:tensorflow:Checkpoint is missing variable [aspp0/BatchNorm/moving_variance]
WARNING:tensorflow:Checkpoint is missing variable [aspp1_depthwise/depthwise_weights]
WARNING:tensorflow:Checkpoint is missing variable [aspp1_depthwise/BatchNorm/gamma]
WARNING:tensorflow:Checkpoint is missing variable [aspp1_depthwise/BatchNorm/beta]
WARNING:tensorflow:Checkpoint is missing variable [aspp1_depthwise/BatchNorm/moving_mean]
WARNING:tensorflow:Checkpoint is missing variable [aspp1_depthwise/BatchNorm/moving_variance]
WARNING:tensorflow:Checkpoint is missing variable [aspp1_pointwise/weights]
WARNING:tensorflow:Checkpoint is missing variable [aspp1_pointwise/BatchNorm/gamma]
WARNING:tensorflow:Checkpoint is missing variable [aspp1_pointwise/BatchNorm/beta]
WARNING:tensorflow:Checkpoint is missing variable [aspp1_pointwise/BatchNorm/moving_mean]
WARNING:tensorflow:Checkpoint is missing variable [aspp1_pointwise/BatchNorm/moving_variance]
WARNING:tensorflow:Checkpoint is missing variable [aspp2_depthwise/depthwise_weights]
WARNING:tensorflow:Checkpoint is missing variable [aspp2_depthwise/BatchNorm/gamma]
WARNING:tensorflow:Checkpoint is missing variable [aspp2_depthwise/BatchNorm/beta]
WARNING:tensorflow:Checkpoint is missing variable [aspp2_depthwise/BatchNorm/moving_mean]
WARNING:tensorflow:Checkpoint is missing variable [aspp2_depthwise/BatchNorm/moving_variance]
WARNING:tensorflow:Checkpoint is missing variable [aspp2_pointwise/weights]
WARNING:tensorflow:Checkpoint is missing variable [aspp2_pointwise/BatchNorm/gamma]
WARNING:tensorflow:Checkpoint is missing variable [aspp2_pointwise/BatchNorm/beta]
WARNING:tensorflow:Checkpoint is missing variable [aspp2_pointwise/BatchNorm/moving_mean]
WARNING:tensorflow:Checkpoint is missing variable [aspp2_pointwise/BatchNorm/moving_variance]
WARNING:tensorflow:Checkpoint is missing variable [aspp3_depthwise/depthwise_weights]
WARNING:tensorflow:Checkpoint is missing variable [aspp3_depthwise/BatchNorm/gamma]
WARNING:tensorflow:Checkpoint is missing variable [aspp3_depthwise/BatchNorm/beta]
WARNING:tensorflow:Checkpoint is missing variable [aspp3_depthwise/BatchNorm/moving_mean]
WARNING:tensorflow:Checkpoint is missing variable [aspp3_depthwise/BatchNorm/moving_variance]
WARNING:tensorflow:Checkpoint is missing variable [aspp3_pointwise/weights]
WARNING:tensorflow:Checkpoint is missing variable [aspp3_pointwise/BatchNorm/gamma]
WARNING:tensorflow:Checkpoint is missing variable [aspp3_pointwise/BatchNorm/beta]
WARNING:tensorflow:Checkpoint is missing variable [aspp3_pointwise/BatchNorm/moving_mean]
WARNING:tensorflow:Checkpoint is missing variable [aspp3_pointwise/BatchNorm/moving_variance]
WARNING:tensorflow:Checkpoint is missing variable [concat_projection/weights]
WARNING:tensorflow:Checkpoint is missing variable [concat_projection/BatchNorm/gamma]
WARNING:tensorflow:Checkpoint is missing variable [concat_projection/BatchNorm/beta]
WARNING:tensorflow:Checkpoint is missing variable [concat_projection/BatchNorm/moving_mean]
WARNING:tensorflow:Checkpoint is missing variable [concat_projection/BatchNorm/moving_variance]
WARNING:tensorflow:Checkpoint is missing variable [decoder/feature_projection0/weights]
WARNING:tensorflow:Checkpoint is missing variable [decoder/feature_projection0/BatchNorm/gamma]
WARNING:tensorflow:Checkpoint is missing variable [decoder/feature_projection0/BatchNorm/beta]
WARNING:tensorflow:Checkpoint is missing variable [decoder/feature_projection0/BatchNorm/moving_mean]
WARNING:tensorflow:Checkpoint is missing variable [decoder/feature_projection0/BatchNorm/moving_variance]
WARNING:tensorflow:Checkpoint is missing variable [decoder/decoder_conv0_depthwise/depthwise_weights]
WARNING:tensorflow:Checkpoint is missing variable [decoder/decoder_conv0_depthwise/BatchNorm/gamma]
WARNING:tensorflow:Checkpoint is missing variable [decoder/decoder_conv0_depthwise/BatchNorm/beta]
WARNING:tensorflow:Checkpoint is missing variable [decoder/decoder_conv0_depthwise/BatchNorm/moving_mean]
WARNING:tensorflow:Checkpoint is missing variable [decoder/decoder_conv0_depthwise/BatchNorm/moving_variance]
WARNING:tensorflow:Checkpoint is missing variable [decoder/decoder_conv0_pointwise/weights]
WARNING:tensorflow:Checkpoint is missing variable [decoder/decoder_conv0_pointwise/BatchNorm/gamma]
WARNING:tensorflow:Checkpoint is missing variable [decoder/decoder_conv0_pointwise/BatchNorm/beta]
WARNING:tensorflow:Checkpoint is missing variable [decoder/decoder_conv0_pointwise/BatchNorm/moving_mean]
WARNING:tensorflow:Checkpoint is missing variable [decoder/decoder_conv0_pointwise/BatchNorm/moving_variance]
WARNING:tensorflow:Checkpoint is missing variable [decoder/decoder_conv1_depthwise/depthwise_weights]
WARNING:tensorflow:Checkpoint is missing variable [decoder/decoder_conv1_depthwise/BatchNorm/gamma]
WARNING:tensorflow:Checkpoint is missing variable [decoder/decoder_conv1_depthwise/BatchNorm/beta]
WARNING:tensorflow:Checkpoint is missing variable [decoder/decoder_conv1_depthwise/BatchNorm/moving_mean]
WARNING:tensorflow:Checkpoint is missing variable [decoder/decoder_conv1_depthwise/BatchNorm/moving_variance]
WARNING:tensorflow:Checkpoint is missing variable [decoder/decoder_conv1_pointwise/weights]
WARNING:tensorflow:Checkpoint is missing variable [decoder/decoder_conv1_pointwise/BatchNorm/gamma]
WARNING:tensorflow:Checkpoint is missing variable [decoder/decoder_conv1_pointwise/BatchNorm/beta]
WARNING:tensorflow:Checkpoint is missing variable [decoder/decoder_conv1_pointwise/BatchNorm/moving_mean]
WARNING:tensorflow:Checkpoint is missing variable [decoder/decoder_conv1_pointwise/BatchNorm/moving_variance]
WARNING:tensorflow:Checkpoint is missing variable [logits/semantic/weights]
WARNING:tensorflow:Checkpoint is missing variable [logits/semantic/biases]
WARNING:tensorflow:Checkpoint is missing variable [image_pooling/weights/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [image_pooling/BatchNorm/gamma/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [image_pooling/BatchNorm/beta/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [aspp0/weights/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [aspp0/BatchNorm/gamma/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [aspp0/BatchNorm/beta/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [aspp1_depthwise/depthwise_weights/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [aspp1_depthwise/BatchNorm/gamma/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [aspp1_depthwise/BatchNorm/beta/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [aspp1_pointwise/weights/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [aspp1_pointwise/BatchNorm/gamma/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [aspp1_pointwise/BatchNorm/beta/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [aspp2_depthwise/depthwise_weights/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [aspp2_depthwise/BatchNorm/gamma/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [aspp2_depthwise/BatchNorm/beta/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [aspp2_pointwise/weights/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [aspp2_pointwise/BatchNorm/gamma/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [aspp2_pointwise/BatchNorm/beta/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [aspp3_depthwise/depthwise_weights/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [aspp3_depthwise/BatchNorm/gamma/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [aspp3_depthwise/BatchNorm/beta/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [aspp3_pointwise/weights/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [aspp3_pointwise/BatchNorm/gamma/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [aspp3_pointwise/BatchNorm/beta/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [concat_projection/weights/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [concat_projection/BatchNorm/gamma/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [concat_projection/BatchNorm/beta/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [decoder/feature_projection0/weights/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [decoder/feature_projection0/BatchNorm/gamma/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [decoder/feature_projection0/BatchNorm/beta/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [decoder/decoder_conv0_depthwise/depthwise_weights/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [decoder/decoder_conv0_depthwise/BatchNorm/gamma/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [decoder/decoder_conv0_depthwise/BatchNorm/beta/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [decoder/decoder_conv0_pointwise/weights/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [decoder/decoder_conv0_pointwise/BatchNorm/gamma/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [decoder/decoder_conv0_pointwise/BatchNorm/beta/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [decoder/decoder_conv1_depthwise/depthwise_weights/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [decoder/decoder_conv1_depthwise/BatchNorm/gamma/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [decoder/decoder_conv1_depthwise/BatchNorm/beta/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [decoder/decoder_conv1_pointwise/weights/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [decoder/decoder_conv1_pointwise/BatchNorm/gamma/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [decoder/decoder_conv1_pointwise/BatchNorm/beta/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [logits/semantic/weights/Momentum]
WARNING:tensorflow:Checkpoint is missing variable [logits/semantic/biases/Momentum]
INFO:tensorflow:Create CheckpointSaverHook.

我认为这个说明checkpoint少了decode与aspp的网络。而beta是有的。因为在代码中,aspp是否使用是通过参数空置的(model.py 397行:

model_options.aspp_with_batch_norm

),decode是否使用也是通过参数控制的(

decoder_output_stride如果不给参数就直接删除整个decoder。

),modelvariant只会影响encoder阶段,也就是feature_extractor.

那么我的确认方式是1,debug2,看tensorboard

ValueError: Total size of new array must be unchanged for resnet_v1_101/block1/unit_1/bottleneck_v1/shortcut/weights lh_shape: [(1, 1, 128, 256)], rh_shape: [(1, 1, 64, 256)]

之所以废这么多话是想说,复现可能会有一定问题,因为你需要先用coco预训练,再用voc2012 trainaug set预训练,得到的权重才可以和论文比。

我是没用coco。

更-------------------------

这个病毒越演愈烈,正好在北京直面过非典,实际上非典时期结束有一部分是因为天气变热,病毒传播困难。再加上隔离严格。所以武汉肺炎终究会过去。就是医护人员在湖北人手不足,新闻上全家感染的例子不在少数。致死率没有非典严重,大多数是并发症。但是传染的速度真的是太快了。虽然不能恐慌,但是也要严肃对待。未感染的需要提高免疫力,摄取维生素c,注意保暖,不要感冒发烧,以免给医疗系统增加压力。

 

这里贴的是resnet101在voc的结果,

这个贴的是xception,可以看到,这里采用了coco以及JFT两个数据集预训练作为变量。而resnet则没有,所以很有可能是没用coco,只用了imagenet。

所以我的总的bash代码是这样的。

#!/bin/bash
# Copyright 2018 The TensorFlow Authors All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
#
# This script is used to run local test on PASCAL VOC 2012. Users could also
# modify from this script for their use case.
#
# Usage:
#   # From the tensorflow/models/research/deeplab directory.
#   sh ./local_test.sh
#
## Exit immediately if a command exits with a non-zero status.
set -e# Move one-level up to tensorflow/models/research directory.
cd ..# Update PYTHONPATH.
export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim# Set up the working environment.
CURRENT_DIR=$(pwd)
WORK_DIR="${CURRENT_DIR}/deeplab"
RES_DIR="${CURRENT_DIR}/resnet"
RES_WEIGHT="${CURRENT_DIR}/resnet/model.ckpt"
#export CUDA_VISIBLE_DEVICES=3
# Run model_test first to make sure the PYTHONPATH is correctly set.
#python "${WORK_DIR}"/model_test.py -v# Go to datasets folder and download PASCAL VOC 2012 segmentation dataset.
DATASET_DIR="datasets"
cd "${WORK_DIR}/${DATASET_DIR}"
#sh download_and_convert_voc2012.sh# Go back to original directory.
cd "${CURRENT_DIR}"# Set up the working directories.
PASCAL_FOLDER="pascal_voc_seg"
EXP_FOLDER="result/offres_freze"
INIT_FOLDER="${WORK_DIR}/${DATASET_DIR}/${PASCAL_FOLDER}/init_models"
COCO_PRE="${WORK_DIR}/${DATASET_DIR}/${PASCAL_FOLDER}/coco_pretrain"
TRAIN_LOGDIR="${WORK_DIR}/${DATASET_DIR}/${PASCAL_FOLDER}/${EXP_FOLDER}/train"
VOC_LOGDIR="${WORK_DIR}/${DATASET_DIR}/${PASCAL_FOLDER}/${EXP_FOLDER}/train_voc"
EVAL_LOGDIR="${WORK_DIR}/${DATASET_DIR}/${PASCAL_FOLDER}/${EXP_FOLDER}/eval"
VIS_LOGDIR="${WORK_DIR}/${DATASET_DIR}/${PASCAL_FOLDER}/${EXP_FOLDER}/vis"
EXPORT_DIR="${WORK_DIR}/${DATASET_DIR}/${PASCAL_FOLDER}/${EXP_FOLDER}/export"
mkdir -p "${INIT_FOLDER}"
mkdir -p "${TRAIN_LOGDIR}"
mkdir -p "${EVAL_LOGDIR}"
mkdir -p "${VIS_LOGDIR}"
mkdir -p "${EXPORT_DIR}"# Copy locally the trained checkpoint as the initial checkpoint.
TF_INIT_ROOT="http://download.tensorflow.org/models"
TF_INIT_CKPT="deeplabv3_pascal_train_aug_2018_01_04.tar.gz"
cd "${INIT_FOLDER}"
#wget -nd -c "${TF_INIT_ROOT}/${TF_INIT_CKPT}"cd "${CURRENT_DIR}"PASCAL_DATASET="${WORK_DIR}/${DATASET_DIR}/${PASCAL_FOLDER}/tfrecord"# Train 10 iterations.
NUM_ITERATIONS=20
echo ${PASCAL_DATASET}python "${WORK_DIR}"/train.py \--logtostderr \--train_split="train_aug" \--model_variant="resnet_v1_101_beta" \--weight_decay=0.001 \--atrous_rates=6 \--atrous_rates=12 \--atrous_rates=18 \--output_stride=16 \--decoder_output_stride=4 \--train_crop_size="513,513" \--train_batch_size=32 \--num_clones=8 \--training_number_of_steps=30000 \--fine_tune_batch_norm=True \--train_logdir="${TRAIN_LOGDIR}" \--dataset_dir="${PASCAL_DATASET}" \--tf_initial_checkpoint="${RES_WEIGHT}" \python "${WORK_DIR}"/train.py \--logtostderr \--train_split="train" \--model_variant="resnet_v1_101_beta" \--weight_decay=0.0001 \--atrous_rates=6 \--atrous_rates=12 \--atrous_rates=18 \--output_stride=16 \--decoder_output_stride=4 \--train_crop_size="513,513" \--train_batch_size=32 \--num_clones=8 \--training_number_of_steps=30000 \--fine_tune_batch_norm=True \--train_logdir="${VOC_LOGDIR}" \--dataset_dir="${PASCAL_DATASET}" \--tf_initial_checkpoint="${TRAIN_LOGDIR}/model.ckpt-30000" \

论文较真:

 

由于官方没写resnet作为backbone怎么训练的,所以这里放一个同样用deeplabv3+,resnet,cvpr的文章:

Decoders Matter for Semantic Segmentation:Data-Dependent Decoding Enables Flexible Feature Aggregation 

在val的pascal voc数据集大概是72,73的准确率:


http://chatgpt.dhexx.cn/article/RUVxGxIN.shtml

相关文章

基于pytorch+Resnet101加GPT搭建AI玩王者荣耀

本源码模型主要用了SamLynnEvans Transformer 的源码的解码部分。以及pytorch自带的预训练模型"resnet101-5d3b4d8f.pth" 本资源整理自网络,源地址:https://github.com/FengQuanLi/ResnetGPT 注意运行本代码需要注意以下几点 注意!…

resnet101网络_网络标准101

resnet101网络 让我告诉你一个故事。 一旦我为我们的设计系统构建了另一个日期选择器组件。 它由文本输入和带有日历的弹出窗口组成,单击可显示日历。 然后,可以在外部单击或选择日期来关闭弹出窗口。 外部点击逻辑的大多数实现都是通过将实际点击侦听器…

基于ResNet101实现猴痘病毒识别任务

前言 大家好,我是阿光。 本专栏整理了《PyTorch深度学习项目实战100例》,内包含了各种不同的深度学习项目,包含项目原理以及源码,每一个项目实例都附带有完整的代码+数据集。 正在更新中~ ✨ 🚨 我的项目环境: 平台:Windows10语言环境:python3.7编译器:PyCharmPy…

使用ResNet101作为预训练模型训练Faster-RCNN-TensorFlow-Python3-master

使用VGG16作为预训练模型训练Faster-RCNN-TensorFlow-Python3-master的详细步骤→Windows10Faster-RCNN-TensorFlow-Python3-masterVOC2007数据集。 如果使用ResNet101作为预训练模型训练Faster-RCNN-TensorFlow-Python3-master,在之前使用VGG16作为预训练模型的训练…

TensorRT学习笔记--基于FCN-ResNet101推理引擎实现语义分割

目录 前言 1--Pytorch模型转换为Onnx模型 2--Onnx模型可视化及测试 2-1--可视化Onnx模型 2-2--测试Onnx模型 3--Onnx模型转换为Tensor RT推理模型 4--基于Tensor RT使用推理引擎实现语义分割 前言 基于Tensor RT的模型转换流程:Pytorch → Onnx → Tensor RT…

迁移学习之ResNet50和ResNet101(图像识别)

文章目录 1.实现的效果:2.主文件TransorResNet.py: 1.实现的效果: 实际的图片: (1)可以看到ResNet50预测的前三个结果中第一个结果为:whippet(小灵狗) (2)Re…

Mask-RCNN(2)Resnet101

1. 对应着图像中的CNN部分,其对输入进来的图片有尺寸要求,需要可以整除2的6次方。在进行特征提取后,利用长宽压缩了两次、三次、四次、五次的特征层来进行特征金字塔结构的构造。Mask-RCNN使用Resnet101作为主干特征提取网络 2.ResNet101有…

Pytorch-预训练网络

预训练网络 我们可以把预训练的神经网络看作一个接收输入并生成输出的程序,该程序的行为是由神经网络的结构以及它在训练过程中所看到的样本所决定的,即期望的输入-输出对,或者期望输出应该满足的特性。我们可以在Pytorch中加载和运行这些预…

基于ResNet-101深度学习网络的图像目标识别算法matlab仿真

目录 1.算法理论概述 1.1、ResNet-101的基本原理 1.2、基于深度学习框架的ResNet-101实现 1.3网络训练与测试 2.部分核心程序 3.算法运行软件版本 4.算法运行效果图预览 5.算法完整程序工程 1.算法理论概述 介绍ResNet-101的基本原理和数学模型,并解释其在图…

【深度学习】ResNet网络详解

文章目录 ResNet参考结构概况conv1与池化层残差结构Batch Normalization总结 ResNet 参考 ResNet论文: https://arxiv.org/abs/1512.03385 本文主要参考视频:https://www.bilibili.com/video/BV1T7411T7wa https://www.bilibili.com/video/BV14E411H7U…

【使用Pytorch实现ResNet网络模型:ResNet50、ResNet101和ResNet152】

使用Pytorch实现Resnet网络模型:ResNet50、ResNet101和ResNet152 介绍什么是 ResNet?ResNet 的架构使用Pytorch构建 ResNet网络 介绍 在深度学习和计算机视觉领域取得了一系列突破。尤其是随着非常深的卷积神经网络的引入,这些模型有助于在图…

使用PyTorch搭建ResNet101、ResNet152网络

ResNet18的搭建请移步:使用PyTorch搭建ResNet18网络并使用CIFAR10数据集训练测试 ResNet34的搭建请移步:使用PyTorch搭建ResNet34网络 ResNet34的搭建请移步:使用PyTorch搭建ResNet50网络 参照我的ResNet50的搭建,由于50层以上几…

Java中的数组

数组 1.什么是数组 数组就是存储相同数据类型的一组数据,且长度固定 基本数据类型4类8种:byte/char/short/int/long/float/double/boolean 数组,是由同一种数据类型按照一定的顺序排序的集合,给这个数组起一个名字。是一种数据类型&#…

java输出数组(java输出数组)

多维数组在Java里如何创建多维数组? 这从第四个例子可以看出,它向我们演示了用花括号收集多个new表达式的能力: Integer[][] a4 { { new Integer (1), new Integer (2)}, { new Integer (3), new Integer (4)}, { new Integer (5), new…

java怎么输出数组(Java怎么给数组赋值)

Java中数组输出的三种方式。第一种方式,传统的for循环方式,第二种方式,for each循环,  第三种方式,利用Array类中的toString方法. 定义一个int类型数组,用于输出 int[] array={1,2,3,4,5}; 第一种方式,传统的for循环方式 for(int i=0;i {System.out.println(a[i]); } 第…

数组的输入与输出

前言: 我们知道对一个字符数组进行输入与输出时会用到: 输入:scanf,getchar,gets 输出:printf,putchar,puts 然而可能还有很多的朋友对这些还不是很了解,今天让我们共同学习数组的输入与输出吧。 %c格式是用于输入…

Java二维数组的输出

1. Java二维数组的输出<1> (1) 输出结果右对齐"%5d" public class HelloWorld {public static void main(String[] args){int myArray[ ][ ] { {1,2}, {7,2}, {3,4} };for(int i0; i<3; i){for (int j0; j<2; j)System.out.printf("%5d",my…

Java中数组的输入输出

数组的输入 首先声明一个int型数组 int[] a 或者 int a[] 给数组分配空间 anew int[10]; 和声明连起来就是int[] anew int[10]; 或者是 int a[]new int[10]; 给数组赋值 a[0]1;//0代表的是数组的第1个元素 ,元素下标为0 a[1]1;//1代表的是数组的第2个元素 ,元素下标为0 …

Java 数组的输入输出

Java中要对控制台进行输入操作的话要调用Scanner类&#xff0c;定义一个扫描的对象&#xff0c;例&#xff1a; //要导入java.util.Scanner; Scanner scanner new Scanner(System.in); 这样便打开了输入流&#xff0c;接下来定义数组&#xff1a; int[] n new int[4];//使…

Java中字符串数组的输入与输出

今天刷题遇到一个坑&#xff0c;老是接收不到字符串数组。即用str[i]sc.nextLine();这样的方式去接收数组的话&#xff0c;打印的时候总是会少一个。 import java.util.Scanner;public class test {public static void main(String[] args) {Scanner sc new Scanner(System.i…