使用TensorFlow-Slim进行图像分类

2023-05-16

参考 https://github.com/tensorflow/models/tree/master/slim

使用TensorFlow-Slim进行图像分类

准备

  1. 安装TensorFlow

    参考 https://www.tensorflow.org/install/

    如在Ubuntu下安装TensorFlow with GPU support, python 2.7版本

    wget https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.2.0-cp27-none-linux_x86_64.whl
    pip install tensorflow_gpu-1.2.0-cp27-none-linux_x86_64.whl
  2. 下载TF-slim图像模型库

    cd $WORKSPACE
    git clone https://github.com/tensorflow/models/
  3. 准备数据

    有不少公开数据集,这里以官网提供的Flowers为例。

    官网提供了下载和转换数据的代码,为了理解代码并能使用自己的数据,这里参考官方提供的代码进行修改。

    cd $WORKSPACE/data
    wget http://download.tensorflow.org/example_images/flower_photos.tgz
    tar zxf flower_photos.tgz

    数据集文件夹结构如下:

    flower_photos
    ├── daisy
    │   ├── 100080576_f52e8ee070_n.jpg
    │   └── ...
    ├── dandelion
    ├── LICENSE.txt
    ├── roses
    ├── sunflowers
    └── tulips

    由于实际情况中我们自己的数据集并不一定把图片按类别放在不同的文件夹里,故我们生成list.txt来表示图片路径与标签的关系。

    Python代码:

    import os
    
    class_names_to_ids = {'daisy': 0, 'dandelion': 1, 'roses': 2, 'sunflowers': 3, 'tulips': 4}
    data_dir = 'flower_photos/'
    output_path = 'list.txt'
    
    fd = open(output_path, 'w')
    for class_name in class_names_to_ids.keys():
        images_list = os.listdir(data_dir + class_name)
        for image_name in images_list:
            fd.write('{}/{} {}\n'.format(class_name, image_name, class_names_to_ids[class_name]))
    
    fd.close()

    为了方便后期查看label标签,也可以定义labels.txt

    daisy
    dandelion
    roses
    sunflowers
    tulips

    随机生成训练集与验证集:

    Python代码:

    import random
    
    _NUM_VALIDATION = 350
    _RANDOM_SEED = 0
    list_path = 'list.txt'
    train_list_path = 'list_train.txt'
    val_list_path = 'list_val.txt'
    
    fd = open(list_path)
    lines = fd.readlines()
    fd.close()
    random.seed(_RANDOM_SEED)
    random.shuffle(lines)
    
    fd = open(train_list_path, 'w')
    for line in lines[_NUM_VALIDATION:]:
        fd.write(line)
    
    fd.close()
    fd = open(val_list_path, 'w')
    for line in lines[:_NUM_VALIDATION]:
        fd.write(line)
    
    fd.close()

    生成TFRecord数据:

    Python代码:

    import sys
    sys.path.insert(0, '../models/slim/')
    from datasets import dataset_utils
    import math
    import os
    import tensorflow as tf
    
    def convert_dataset(list_path, data_dir, output_dir, _NUM_SHARDS=5):
        fd = open(list_path)
        lines = [line.split() for line in fd]
        fd.close()
        num_per_shard = int(math.ceil(len(lines) / float(_NUM_SHARDS)))
        with tf.Graph().as_default():
            decode_jpeg_data = tf.placeholder(dtype=tf.string)
            decode_jpeg = tf.image.decode_jpeg(decode_jpeg_data, channels=3)
            with tf.Session('') as sess:
                for shard_id in range(_NUM_SHARDS):
                    output_path = os.path.join(output_dir,
                        'data_{:05}-of-{:05}.tfrecord'.format(shard_id, _NUM_SHARDS))
                    tfrecord_writer = tf.python_io.TFRecordWriter(output_path)
                    start_ndx = shard_id * num_per_shard
                    end_ndx = min((shard_id + 1) * num_per_shard, len(lines))
                    for i in range(start_ndx, end_ndx):
                        sys.stdout.write('\r>> Converting image {}/{} shard {}'.format(
                            i + 1, len(lines), shard_id))
                        sys.stdout.flush()
                        image_data = tf.gfile.FastGFile(os.path.join(data_dir, lines[i][0]), 'rb').read()
                        image = sess.run(decode_jpeg, feed_dict={decode_jpeg_data: image_data})
                        height, width = image.shape[0], image.shape[1]
                        example = dataset_utils.image_to_tfexample(
                            image_data, b'jpg', height, width, int(lines[i][1]))
                        tfrecord_writer.write(example.SerializeToString())
                    tfrecord_writer.close()
        sys.stdout.write('\n')
        sys.stdout.flush()
    
    os.system('mkdir -p train')
    convert_dataset('list_train.txt', 'flower_photos', 'train/')
    os.system('mkdir -p val')
    convert_dataset('list_val.txt', 'flower_photos', 'val/')

    得到的文件夹结构如下:

    data
    ├── flower_photos
    ├── labels.txt
    ├── list_train.txt
    ├── list.txt
    ├── list_val.txt
    ├── train
    │   ├── data_00000-of-00005.tfrecord
    │   ├── ...
    │   └── data_00004-of-00005.tfrecord
    └── val
        ├── data_00000-of-00005.tfrecord
        ├── ...
        └── data_00004-of-00005.tfrecord
  4. (可选)下载模型

    官方提供了不少预训练模型,这里以Inception-ResNet-v2以例。

    cd $WORKSPACE/checkpoints
    wget http://download.tensorflow.org/models/inception_resnet_v2_2016_08_30.tar.gz
    tar zxf inception_resnet_v2_2016_08_30.tar.gz

训练

  1. 读入数据

    官方提供了读入Flowers数据集的代码models/slim/datasets/flowers.py,同样这里也是参考并修改成能读入上面定义的通用数据集。

    把下面代码写入models/slim/datasets/dataset_classification.py

    import os
    import tensorflow as tf
    slim = tf.contrib.slim
    
    def get_dataset(dataset_dir, num_samples, num_classes, labels_to_names_path=None, file_pattern='*.tfrecord'):
        file_pattern = os.path.join(dataset_dir, file_pattern)
        keys_to_features = {
            'image/encoded': tf.FixedLenFeature((), tf.string, default_value=''),
            'image/format': tf.FixedLenFeature((), tf.string, default_value='png'),
            'image/class/label': tf.FixedLenFeature(
                [], tf.int64, default_value=tf.zeros([], dtype=tf.int64)),
        }
        items_to_handlers = {
            'image': slim.tfexample_decoder.Image(),
            'label': slim.tfexample_decoder.Tensor('image/class/label'),
        }
        decoder = slim.tfexample_decoder.TFExampleDecoder(keys_to_features, items_to_handlers)
        items_to_descriptions = {
            'image': 'A color image of varying size.',
            'label': 'A single integer between 0 and ' + str(num_classes - 1),
        }
        labels_to_names = None
        if labels_to_names_path is not None:
            fd = open(labels_to_names_path)
            labels_to_names = {i : line.strip() for i, line in enumerate(fd)}
            fd.close()
        return slim.dataset.Dataset(
                data_sources=file_pattern,
                reader=tf.TFRecordReader,
                decoder=decoder,
                num_samples=num_samples,
                items_to_descriptions=items_to_descriptions,
                num_classes=num_classes,
                labels_to_names=labels_to_names)
  2. 构建模型

    官方提供了许多模型在models/slim/nets/

    如需要自定义模型,则参考官方提供的模型并放在对应的文件夹即可。

  3. 开始训练

    官方提供了训练脚本,如果使用官方的数据读入和处理,可使用以下方式开始训练。

    cd $WORKSPACE/models/slim
    CUDA_VISIBLE_DEVICES="0" python train_image_classifier.py \
        --train_dir=train_logs \
        --dataset_name=flowers \
        --dataset_split_name=train \
        --dataset_dir=../../data/flowers \
        --model_name=inception_resnet_v2 \
        --checkpoint_path=../../checkpoints/inception_resnet_v2_2016_08_30.ckpt \
        --checkpoint_exclude_scopes=InceptionResnetV2/Logits,InceptionResnetV2/AuxLogits \
        --trainable_scopes=InceptionResnetV2/Logits,InceptionResnetV2/AuxLogits \
        --max_number_of_steps=1000 \
        --batch_size=32 \
        --learning_rate=0.01 \
        --learning_rate_decay_type=fixed \
        --save_interval_secs=60 \
        --save_summaries_secs=60 \
        --log_every_n_steps=10 \
        --optimizer=rmsprop \
        --weight_decay=0.00004

    不fine-tune把--checkpoint_path, --checkpoint_exclude_scopes--trainable_scopes删掉。

    fine-tune所有层把--checkpoint_exclude_scopes--trainable_scopes删掉。

    如果只使用CPU则加上--clone_on_cpu=True

    其它参数可删掉用默认值或自行修改。

    使用自己的数据则需要修改models/slim/train_image_classifier.py

    from datasets import dataset_factory

    修改为

    from datasets import dataset_classification

    dataset = dataset_factory.get_dataset(
        FLAGS.dataset_name, FLAGS.dataset_split_name, FLAGS.dataset_dir)

    修改为

    dataset = dataset_classification.get_dataset(
        FLAGS.dataset_dir, FLAGS.num_samples, FLAGS.num_classes, FLAGS.labels_to_names_path)

    tf.app.flags.DEFINE_string(
        'dataset_dir', None, 'The directory where the dataset files are stored.')

    后加入

    tf.app.flags.DEFINE_integer(
        'num_samples', 3320, 'Number of samples.')
    
    tf.app.flags.DEFINE_integer(
        'num_classes', 5, 'Number of classes.')
    
    tf.app.flags.DEFINE_string(
        'labels_to_names_path', None, 'Label names file path.')

    训练时执行以下命令即可:

    cd $WORKSPACE/models/slim
    python train_image_classifier.py \
        --train_dir=train_logs \
        --dataset_dir=../../data/train \
        --num_samples=3320 \
        --num_classes=5 \
        --labels_to_names_path=../../data/labels.txt \
        --model_name=inception_resnet_v2 \
        --checkpoint_path=../../checkpoints/inception_resnet_v2_2016_08_30.ckpt \
        --checkpoint_exclude_scopes=InceptionResnetV2/Logits,InceptionResnetV2/AuxLogits \
        --trainable_scopes=InceptionResnetV2/Logits,InceptionResnetV2/AuxLogits
  4. 可视化log

    可一边训练一边可视化训练的log,可看到Loss趋势。

    tensorboard --logdir train_logs/

验证

官方提供了验证脚本。

python eval_image_classifier.py \
    --checkpoint_path=train_logs \
    --eval_dir=eval_logs \
    --dataset_name=flowers \
    --dataset_split_name=validation \
    --dataset_dir=../../data/flowers \
    --model_name=inception_resnet_v2

同样,如果是使用自己的数据集,则需要修改models/slim/eval_image_classifier.py

from datasets import dataset_factory

修改为

from datasets import dataset_classification

dataset = dataset_factory.get_dataset(
    FLAGS.dataset_name, FLAGS.dataset_split_name, FLAGS.dataset_dir)

修改为

dataset = dataset_classification.get_dataset(
    FLAGS.dataset_dir, FLAGS.num_samples, FLAGS.num_classes, FLAGS.labels_to_names_path)

tf.app.flags.DEFINE_string(
    'dataset_dir', None, 'The directory where the dataset files are stored.')

后加入

tf.app.flags.DEFINE_integer(
    'num_samples', 350, 'Number of samples.')

tf.app.flags.DEFINE_integer(
    'num_classes', 5, 'Number of classes.')

tf.app.flags.DEFINE_string(
    'labels_to_names_path', None, 'Label names file path.')

验证时执行以下命令即可:

python eval_image_classifier.py \
    --checkpoint_path=train_logs \
    --eval_dir=eval_logs \
    --dataset_dir=../../data/val \
    --num_samples=350 \
    --num_classes=5 \
    --model_name=inception_resnet_v2

可以一边训练一边验证,,注意使用其它的GPU或合理分配显存。

同样也可以可视化log,如果已经在可视化训练的log则建议使用其它端口,如:

tensorboard --logdir eval_logs/ --port 6007

测试

参考models/slim/eval_image_classifier.py,可编写读取图片用模型进行推导的脚本models/slim/test_image_classifier.py

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import os
import math
import tensorflow as tf

from nets import nets_factory
from preprocessing import preprocessing_factory

slim = tf.contrib.slim

tf.app.flags.DEFINE_string(
    'master', '', 'The address of the TensorFlow master to use.')

tf.app.flags.DEFINE_string(
    'checkpoint_path', '/tmp/tfmodel/',
    'The directory where the model was written to or an absolute path to a '
    'checkpoint file.')

tf.app.flags.DEFINE_string(
    'test_path', '', 'Test image path.')

tf.app.flags.DEFINE_integer(
    'num_classes', 5, 'Number of classes.')

tf.app.flags.DEFINE_integer(
    'labels_offset', 0,
    'An offset for the labels in the dataset. This flag is primarily used to '
    'evaluate the VGG and ResNet architectures which do not use a background '
    'class for the ImageNet dataset.')

tf.app.flags.DEFINE_string(
    'model_name', 'inception_v3', 'The name of the architecture to evaluate.')

tf.app.flags.DEFINE_string(
    'preprocessing_name', None, 'The name of the preprocessing to use. If left '
    'as `None`, then the model_name flag is used.')

tf.app.flags.DEFINE_integer(
    'test_image_size', None, 'Eval image size')

FLAGS = tf.app.flags.FLAGS


def main(_):
    if not FLAGS.test_list:
        raise ValueError('You must supply the test list with --test_list')

    tf.logging.set_verbosity(tf.logging.INFO)
    with tf.Graph().as_default():
        tf_global_step = slim.get_or_create_global_step()

        ####################
        # Select the model #
        ####################
        network_fn = nets_factory.get_network_fn(
            FLAGS.model_name,
            num_classes=(FLAGS.num_classes - FLAGS.labels_offset),
            is_training=False)

        #####################################
        # Select the preprocessing function #
        #####################################
        preprocessing_name = FLAGS.preprocessing_name or FLAGS.model_name
        image_preprocessing_fn = preprocessing_factory.get_preprocessing(
            preprocessing_name,
            is_training=False)

        test_image_size = FLAGS.test_image_size or network_fn.default_image_size

        if tf.gfile.IsDirectory(FLAGS.checkpoint_path):
            checkpoint_path = tf.train.latest_checkpoint(FLAGS.checkpoint_path)
        else:
            checkpoint_path = FLAGS.checkpoint_path

        tf.Graph().as_default()
        with tf.Session() as sess:
            image = open(FLAGS.test_path, 'rb').read()
            image = tf.image.decode_jpeg(image, channels=3)
            processed_image = image_preprocessing_fn(image, test_image_size, test_image_size)
            processed_images = tf.expand_dims(processed_image, 0)
            logits, _ = network_fn(processed_images)
            predictions = tf.argmax(logits, 1)
            saver = tf.train.Saver()
            saver.restore(sess, checkpoint_path)
            np_image, network_input, predictions = sess.run([image, processed_image, predictions])
            print('{} {}'.format(FLAGS.test_path, predictions[0]))

if __name__ == '__main__':
    tf.app.run()

测试时执行以下命令即可:

python test_image_classifier.py \
    --checkpoint_path=train_logs/ \
    --test_path=../../data/flower_photos/tulips/6948239566_0ac0a124ee_n.jpg \
    --num_classes=5 \
    --model_name=inception_resnet_v2
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用TensorFlow-Slim进行图像分类 的相关文章

  • Tensorflow 的 LSTM 输入

    I m trying to create an LSTM network in Tensorflow and I m lost in terminology basics I have n time series examples so X
  • 分布式张量流 tf.train.SyncReplicasOptimizer 似乎不同步

    我使用两个工作程序 副本和一个参数服务器 喜欢 ps hosts hosta com 2222 worker hosts hosta com 2223 hostb com 2223 使用tf train SyncReplicasOptimi
  • 在 keras 中使用自定义张量流操作

    我在张量流中有一个脚本 其中包含自定义张量流操作 我想将代码移植到 keras 但我不确定如何在 keras 代码中调用自定义操作 我想在 keras 中使用tensorflow 所以到目前为止我发现的教程描述了与我想要的相反的内容 htt
  • ValueError:维度 (-1) 必须在 [0, 2) 范围内

    我的python版本是3 5 2 我已经安装了keras和tensorflow 并尝试了官方的一些示例 示例链接 示例标题 用于多类 softmax 分类的多层感知器 MLP https keras io getting started s
  • TensorFlow:在输入处获取梯度时性能缓慢

    我正在使用 TensorFlow 构建一个简单的多层感知器 并且我还需要获取神经网络输入损失的梯度 或误差信号 这是我的代码 它有效 cost tf reduce mean tf nn softmax cross entropy with
  • 如何在 Keras 中将多个数据集与一个模型一起使用?

    我正在尝试使用 LSTM 网络通过 Keras 和 Tensorflow 进行外汇预测 我当然希望它能够在很多天的交易中进行训练 但要做到这一点 我必须给它提供具有大跳跃和无运动阶段的连续数据 当市场收盘时 这并不理想 因为它变得由于这些跳
  • 精简 PHP 和 GET 参数

    我使用 Slim PHP 作为 RESTful API 的框架 如何在 Slim PHP 中从 URL 获取 GET 参数 例如 如果我想使用以下内容 http api example com dataset schools zip 999
  • TensorFlow:有没有办法将冻结图转换为检查点模型?

    可以将检查点模型转换为冻结图 ckpt 文件转换为 pb 文件 但是 是否有反向方法将 pb 文件再次转换为检查点文件 我想它需要将常量转换回变量 有没有办法将正确的常量识别为变量并将它们恢复回检查点模型 目前支持将变量转换为常量 http
  • Keras 通过设置种子获得不同的结果[重复]

    这个问题在这里已经有答案了 在keras中 每次运行都有很高的方差和不稳定的性能 为了解决这个问题 根据https keras io getting started faq how can i obtain reproducible res
  • 用于分布式计算的 Tensorflow 设置

    任何人都可以提供有关如何设置张量流以在网络上的许多CPU上工作的指导吗 到目前为止 我发现的所有示例最多只使用一个本地盒子和多个 GPU 我发现我可以在 session opts 中传递目标列表 但我不确定如何在每个盒子上设置张量流来侦听网
  • Tensorflow `tf.layers.batch_normalization` 不会向 `tf.GraphKeys.UPDATE_OPS` 添加更新操作

    以下代码 复制 粘贴可运行 说明了如何使用tf layers batch normalization import tensorflow as tf bn tf layers batch normalization tf constant
  • 在不同的 GPU 上同时训练多个 keras/tensorflow 模型

    我想在 Jupyter Notebook 中同时在多个 GPU 上训练多个模型 我正在使用 4GPU 的节点上工作 我想将一个 GPU 分配给一个模型并同时训练 4 个不同的模型 现在 我通过 例如 为一台笔记本选择 GPU import
  • 在 GPU 支持下对高维数据进行更快的 Kmeans 聚类

    我们一直在使用 Kmeans 来对日志进行聚类 典型的数据集有 10 mill 具有 100k 特征的样本 为了找到最佳 k 我们并行运行多个 Kmeans 并选择轮廓得分最佳的一个 在 90 的情况下 我们最终得到的 k 介于 2 到 1
  • Tensorflow 中的自定义资源

    由于某些原因 我需要为 Tensorflow 实现自定义资源 我试图从查找表实现中获得灵感 如果我理解得好的话 我需要实现3个TF操作 创建我的资源 资源的初始化 例如 在查找表的情况下填充哈希表 执行查找 查找 查询步骤 为了促进实施 我
  • 无法获取未知等级的 Shape 长度

    我有一个神经网络 来自tf data数据生成器和tf keras模型 如下 简化版本 因为太长 dataset A tf data Dataset反对与next x方法调用get next为了x train迭代器和next y方法调用get
  • 如何将 tf.contrib.seq2seq.Helper 用于非嵌入数据?

    我正在尝试使用 tf contrib seq2seq 模块对某些数据 仅 float32 向量 进行预测 但我使用 TensorFlow 中的 seq2seq 模块找到的所有示例都用于翻译 因此用于嵌入 我正在努力准确理解 tf contr
  • 如何手动计算分类交叉熵?

    当我手动计算二元交叉熵时 我应用 sigmoid 来获取概率 然后使用交叉熵公式并平均结果 logits tf constant 1 1 0 1 2 labels tf constant 0 0 1 1 1 probs tf nn sigm
  • tf.gather_nd 直观上是做什么的?

    你能直观地解释一下或者举更多例子吗tf gather nd用于在 Tensorflow 中索引和切片为高维张量 我读了API https www tensorflow org api docs python tf gather nd 但它保
  • Keras model.predict 函数给出输入形状错误

    我已经在 Tensorflow 中实现了通用句子编码器 现在我正在尝试预测句子的类概率 我也将字符串转换为数组 Code if model model type universal classifier basic class probs
  • 为 TFliteconverter 创建代表性数据集的正确方法是什么?

    我正在尝试推断tinyYOLO V2 with INT8权重和激活 我可以使用 TFliteConverter 将权重转换为 INT8 为了INT8激活 我必须提供代表性数据集来估计缩放因子 我创建此类数据集的方法似乎是错误的 正确的程序是

随机推荐

  • 简单医疗系统设计(一)登录界面的制作

    这周由于忙于一些琐事 xff0c python进度比上周慢了一点 xff0c 而且廖老师后面的一些课程也没留下作业 xff0c 所以今天只能拿出以前自己写的一些干货了 先放出完成后的图 xff1a 下面是实现界面设计的代码 xff1a 这里
  • 上传文件超过限制,造成长时间无响应的解决方案

    在上传大文件 xff0c 造成长时间没有响应的情况的解决方案 xff1a 上传大文件时 xff0c 因为http协议的响应问题 xff0c 造成长时间不能向客户端发送响应请求头 解决方案 xff1a 1 向服务器发送上传大文件的reques
  • checkbox的jsTree的一个调用

    lt DOCTYPE HTML PUBLIC 34 W3C DTD HTML 4 01 Transitional EN 34 gt lt html gt lt head gt lt meta http equiv 61 34 Content
  • 灵活使用递归算法,生成Excel文件中的复合表头

    最近 xff0c 在开发中 xff0c 需要导出数据到excel文件 xff0c 文件的表头的格式是不一致的 有复合表头 xff0c 也有单表头 xff0c 那么如何灵活地生成excel文件中的复合表头 首先有一个JSON字符串格式的字段描
  • 在 ibm http server 和 websphere 之间配置 ssl

    在WebSphere的环境中 xff0c 配置SSL xff0c 有一些细节需要注意 xff1a 1 最好是先安装 ibm http server7 32bit xff0c websphere7 再安装插件 2 http server 需要
  • Ext4使用总结(二)简单的hbox布局

    布局的合理利用 xff1a 如图 xff1a xtype 39 container 39 margins 39 5 0 0 0 39 layout align 39 stretch 39 type 39 hbox 39
  • 软件开发者的精力管理(一)

    精力管理对于软件开发者来讲是非常重要的 不希望自己被长周期的项目拖垮 xff0c 不希望被连续的加班所累 我个人认为泛义的时间管理是涉及到多个方面的 而心理学 精力管理则是非常重要的 作为一名从事了多年软件开发的从业者 xff0c 我的一个
  • 如何高效能地学习和使用"工具"?

    在软件开发中 xff0c 应该注意工具的合理使用 xff0c 使得自己变得高效起来 1 工具也是产品 xff0c 有许多的工具是产品化的 既然是产品 xff0c 就很多的服务 xff0c 例如帮助文档 xff0c 论坛 xff0c 咨询人员
  • Ext4使用总结(十二) 采用 CellEditing 方式的Grid,如何取得修改的单元格数据值

    使用cellediting方式编辑数据的grid在保存数据时 xff0c 需要进行数据的处理 xff0c 所以数据处理的方式需要特别注意 cellEditing 插件的事件 listeners edit function editor e
  • 「Ubuntu」Ubuntu中的python终端配置(修改终端默认python配置,软连接,不同版本python环境配置)

    前言 通过这篇博客 xff08 Ubuntu安装Python xff09 安装完Python后 xff0c 想要在终端直接启动想启动的python版本 此时直接在终端输入python2或者python3 xff0c 发现系统已经配置好了py
  • [解题报告] CSDN竞赛第15期

    CSDN编程竞赛报名地址 xff1a https edu csdn net contest detail 29 1 求并集 题目 由小到大输出两个单向有序链表的并集 如链表 A 1 gt 2 gt 5 gt 7 链表 B 3 gt 5 gt
  • JSP开发技术四——————EL表达式

    EL xff08 Expression Language xff09 表达式 xff0c 即正则表达式 用来操作字符串 用一些特定的字符来表示一些代码操作 xff0c 这样简化代码书写 学习正则表达式 xff0c 就是学习一些特殊符号的实用
  • [解题报告] CSDN竞赛第17期

    CSDN编程竞赛报名地址 xff1a https edu csdn net contest detail 31 1 判断胜负 题目 已知两个字符串A B 连续进行读入n次 每次读入的字符串都为A B 输出读入次数最多的字符串 解题报告 模拟
  • [解题报告] CSDN竞赛第18期

    CSDN编程竞赛报名地址 xff1a https edu csdn net contest detail 32 1 单链表排序 题目 单链表的节点定义如下 xff08 C 43 43 xff09 xff1a class Node publi
  • [解题报告] CSDN竞赛第22期

    CSDN编程竞赛报名地址 xff1a https edu csdn net contest detail 36 1 c 43 43 难题 大数加法 题目 大数一直是一个c语言的一个难题 现在我们需要你手动模拟出大数加法过程 请你给出两个大整
  • [解题报告] CSDN竞赛第23期

    CSDN编程竞赛报名地址 xff1a https edu csdn net contest detail 37 1 排查网络故障 题目 A地跟B地的网络中间有n个节点 xff08 不包括A地和B地 xff09 xff0c 相邻的两个节点是通
  • CSDN竞赛第24期

    CSDN编程竞赛报名地址 xff1a https edu csdn net contest detail 38 这次写完第一道题时遇到一个奇怪的情况 xff1a 一直在 运行中 xff0c 然后发现每道题输入做任意代码都出现一直运行中 跟小
  • [Python开发] 使用python读取图片的EXIF

    使用python读取图片的EXIF 方法 使用PIL Image读取图片的EXIF 使用https pypi python org pypi ExifRead 读取图片的EXIF xff0c 得到EXIF标签 xff08 dict类型 xf
  • Partial Least Squares Regression 偏最小二乘法回归

    介绍 定义 偏最小二乘回归 多元线性回归分析 43 典型相关分析 43 主成分分析 输入 xff1a n m 的预测矩阵 X n p 的响应矩阵 Y 输出 X 和 Y 的投影 分数 矩阵 T U R n l 目标 xff1a 最大化 cor
  • 使用TensorFlow-Slim进行图像分类

    参考 https github com tensorflow models tree master slim 使用TensorFlow Slim进行图像分类 准备 安装TensorFlow 参考 https www tensorflow o