【object detection】RCNN 实践篇 - 使用 Alexnet 预训练 17-flower 数据集(17分类),使用 2-flower 数据集进行 fine-tuning

2023-10-29

前言

最近根据制定的“Deep Learning”学习计划,11月份的主要任务是:熟悉各大DL网络模型,主要以分类和检测为主;看论文;熟悉病理数据等。我们有一个2人组的小分队,我这个月的主要工作集中在学习目标检测的经典算法以及基于tensorflow或者keras跑一些经典的案例,主要有R-CNN,SPP-Net,Fast-RCNN,Faster-RCNN,YOLO等;另一名成员主要学习分类相关的经典网络模型,主要是google-net一系列的模型(inception-v1,inception-v2,inception-v3,resnet 等)。我们分别要整理出一份关于检测分类的详细报告,然后不断完善、互相交流讨论、分享,发挥小分队的优势。

本文主要结合实践对R-CNN 进行整理。其中 R 表示的是候选区(Region Proposal), CNN 部分使用经典的 AlexNet 网络模型,先来看个关于 AlexNet 的图示感受一下。

2012 年,Hinton 的学生 Alex Krizhevsky 提出了深度卷积神经网络模型AlexNet,它可以算是 LeNet 的一种更深更宽的版本,几个关键点整理如下:

1)首次在CNN 中成功应用了 ReLU(非线性激活函数)、Dropout (防止过拟合)和 LRN 等Trick。
2)使用了GPU 进行运算加速,作者开源了他们在 GPU 上训练卷积神经网络 CUDA 代码。
3)包含了6 亿 3000 万个连接,6000 万个参数和65 万个神经元,拥有 5 个卷积层,其中 3 个卷积层后面连接了最大池化层(MaxPooling Layer),最后还有 3 个全连接层。
4)AlexNet 以显著的优势赢得了竞争激烈的ILSVRC 2012 比赛,top-5 的错误率降低至了16.4%,相比第二名的成绩 26.2%错误率有了巨大的提升。
5)AlexNet 可以说是神经网络在低谷期后的第一次发声,确立了深度学习(深度卷积网络)在计算机视觉的统治地位,同时也推动了深度学习在语音识别、自然语言处理、强化学习等领域的拓展。

本文不过多的介绍理论知识,待后续有更深刻的理解,再针对性的整理相关的理论篇。

AlexNet 模型结构

再来看看R-CNN的图示:

 

RossB.Girshick(RBG)大神使用 Region Proposal + CNN 代替传统目标检测使用的滑动窗口 + 手工设计特征,设计了R-CNN框架。与 R-CNN 相关的几个 关键词 如下所示:

1)Region proposals

2)Selective Search:选择性搜索,找出可能含有物体的框,这些框之间是可以互相重叠互相包含,这样就可以避免暴力枚举出所有框。

3)Warp and Crop:修正区域大小,以适合CNN的输入(AlexNet 的 input layer 的图像大小为 224 x 224 x3,3表示 RGB 3个颜色通道)。

4)Supervisedpre-training:有监督预训练也称迁移学习

5)IOU:交并比IOU=(A∩B)/(A∪B)

6)NMS:非极大值抑制(参考:http://blog.csdn.net/H2008066215019910120/article/details/25917609

7)DPM:使用判别训练的部件模型进行目标检测

 

关于选择性搜索算法,如下图所示,有这么多相关的算法,“Selective Search”只是其中一种。


R-CNN的缺点:

1)要求输入固定大小的图片,需要对原始图片进行crop(裁剪)或者wrap(缩放),在一定程度上导致图片信息的丢失和变形,限制了识别精度。
2)重复计算:R-CNN虽然不再是穷举,但依然有两千个左右的候选框,这些候选框都需要进行CNN操作,计算量依然很大,其中有不少其实是重复计算;
3)SVM模型:线性模型,在标注数据不缺的时候显然不是最好的选择;
4)训练测试分为多步:区域提名、特征提取、分类、回归都是断开的训练的过程,中间数据还需要单独保存;训练的空间和时间代价很高。

本文主要介绍R-CNN的实践,不过多介绍理论知识。具体的理论知识网上有很多相关的教程,我也贴出一些参考网址放在 Reference 部分。

Reference

github 源码(1):https://github.com/edwardbi/DeepLearningModels/tree/master/RCNN

github源码(2)本文使用的代码:http://download.csdn.net/download/houchaoqun_xmu/10138539

selectivesearch:https://github.com/AlpacaDB/selectivesearch

本文实践部分主要参考:https://www.cnblogs.com/edwardbi/p/5647522.html

我看AlexNet【简书】:http://www.jianshu.com/p/58168fec534d

【卷积神经网络-进化史】从LeNet到AlexNet:http://blog.csdn.net/cyh_24/article/details/51440344

深度学习(十八)基于R-CNN的物体检测:http://blog.csdn.net/hjimce/article/details/50187029

深度学习与计算机视觉,看这一篇就够了:https://www.leiphone.com/news/201605/zZqsZiVpcBBPqcGG.html#rd

tflearn官网:http://tflearn.org/installation/

Ubuntu 常用软件安装:http://blog.csdn.net/houchaoqun_xmu/article/details/72461592


准备工作
1)本文实践环境:python3 + tensorflow-1.2.0 + tflearn

tensorflow.__version__ = 1.2.0
tflearn:先装好 tensorflow,然后直接使用 pip install tflearn 命令安装 tflearn

2)下载 github 源码:

git clone https://github.com/Houchaoqun/MachineLearning_DeepLearning.git

3)下载数据集并放在该 project 的根目录下(参考下文的代码结构):

- 链接: https://pan.baidu.com/s/1hrSKz56 

- 密码: gput

4)安装 python 提供的 SelectiveSearch 插件,输入如下命令:

pip install selectivesearch

 

flower 数据集

1)2-flowers:2种花朵的类别(不同时期,不同姿态,不同颜色),每个类别下有30张图片

 

该目录结构如下所示:

hcq@hcq-home:~/document/deepLearning/github/rcnn-tflearn/2flowers$ tree -L 2
.
└── jpg
    ├── 0
    └── 1

2)17-flowers:17种花朵的类别,每个类别下有80张图片

该目录结构如下所示:

hcq@hcq-home:~/document/deepLearning/github/rcnn-tflearn/17flowers$ tree -L 2
.
└── jpg
    ├── 0
    ├── 1
    ├── 10
    ├── 11
    ├── 12
    ├── 13
    ├── 14
    ├── 15
    ├── 16
    ├── 2
    ├── 3
    ├── 4
    ├── 5
    ├── 6
    ├── 7
    ├── 8
    ├── 9
    └── files.txt

tflearn-rcnn 代码结构

hcq@hcq-home:~/document/deepLearning/github/rcnn-tflearn$ tree -L 2
.
├── 17flowers
│   └── jpg
├── 2flowers
│   └── jpg
├── fine_tune_RCNN.py
├── output
│   └── alexnet_oxflowers17
├── preprocessing_RCNN.py
├── RCNN.md
├── RCNN_output.py
├── refine_backup.txt
├── refine_list.txt
├── svm_train
│   ├── 1.txt
│   └── 2.txt
├── testimg7.jpg
├── train_alexnet.py
└── train_list.txt

tflearn 构建 AlexNet 的核心代码

def create_alexnet(num_classes):
    # Building 'AlexNet'
    network = input_data(shape=[None, 224, 224, 3])
    network = conv_2d(network, 96, 11, strides=4, activation='relu')
    network = max_pool_2d(network, 3, strides=2)
    network = local_response_normalization(network)
    network = conv_2d(network, 256, 5, activation='relu')
    network = max_pool_2d(network, 3, strides=2)
    network = local_response_normalization(network)
    network = conv_2d(network, 384, 3, activation='relu')
    network = conv_2d(network, 384, 3, activation='relu')
    network = conv_2d(network, 256, 3, activation='relu')
    network = max_pool_2d(network, 3, strides=2)
    network = local_response_normalization(network)
    network = fully_connected(network, 4096, activation='tanh')
    network = dropout(network, 0.5)
    network = fully_connected(network, 4096, activation='tanh')
    network = dropout(network, 0.5)
    network = fully_connected(network, num_classes, activation='softmax')
    network = regression(network, optimizer='momentum',
                         loss='categorical_crossentropy',
                         learning_rate=0.001)
    return network

实践步骤

1)做好准备工作;

2)执行如下命令,基于 flower17 数据集(标签只有类别)做预训练,得到分类器

python train_alexnet.py

epoch = 200,训练效果如下:

hcq@hcq-home:~/document/deepLearning/github/rcnn-tflearn$ python train_alexnet.py 
2017-11-27 20:07:56.694124: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2017-11-27 20:07:56.694144: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2017-11-27 20:07:56.694162: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2017-11-27 20:07:56.694166: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
2017-11-27 20:07:56.694170: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
2017-11-27 20:07:57.024534: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:901] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2017-11-27 20:07:57.025026: I tensorflow/core/common_runtime/gpu/gpu_device.cc:887] Found device 0 with properties: 
name: GeForce GTX 1080 Ti
major: 6 minor: 1 memoryClockRate (GHz) 1.582
pciBusID 0000:01:00.0
Total memory: 10.90GiB
Free memory: 10.29GiB
2017-11-27 20:07:57.025053: I tensorflow/core/common_runtime/gpu/gpu_device.cc:908] DMA: 0 
2017-11-27 20:07:57.025063: I tensorflow/core/common_runtime/gpu/gpu_device.cc:918] 0:   Y 
2017-11-27 20:07:57.025081: I tensorflow/core/common_runtime/gpu/gpu_device.cc:977] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 1080 Ti, pci bus id: 0000:01:00.0)
2017-11-27 20:08:05.490085: I tensorflow/core/common_runtime/gpu/gpu_device.cc:977] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 1080 Ti, pci bus id: 0000:01:00.0)
loading previous parameters
2017-11-27 20:08:05.569326: I tensorflow/core/common_runtime/gpu/gpu_device.cc:977] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 1080 Ti, pci bus id: 0000:01:00.0)
2017-11-27 20:08:06.435150: I tensorflow/core/common_runtime/gpu/gpu_device.cc:977] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 1080 Ti, pci bus id: 0000:01:00.0)
---------------------------------
Run id: alexnet_oxflowers17
Log directory: output/
---------------------------------
Training samples: 1224
Validation samples: 136
--
Training Step: 200  | total loss: 3.37247 | time: 9.586ss
| Momentum | epoch: 004 | loss: 3.37247 - acc: 0.0630 | val_loss: 2.98178 - val_acc: 0.0515 -- iter: 0160/1224
--
Training Step: 400  | total loss: 3.32241 | time: 17.929s
| Momentum | epoch: 009 | loss: 3.32241 - acc: 0.0576 | val_loss: 2.77432 - val_acc: 0.0588 -- iter: 0320/1224
--
Training Step: 600  | total loss: 3.00749 | time: 26.467s
| Momentum | epoch: 014 | loss: 3.00749 - acc: 0.0976 | val_loss: 2.46418 - val_acc: 0.1544 -- iter: 0480/1224
-- ... ... ... 
Training Step: 7600  | total loss: 0.00295 | time: 66.383s
| Momentum | epoch: 193 | loss: 0.00295 - acc: 0.9999 | val_loss: 0.78864 - val_acc: 0.8088 -- iter: 1088/1224
--
Training Step: 7800  | total loss: 0.00561 | time: 76.434s
| Momentum | epoch: 198 | loss: 0.00561 - acc: 0.9998 | val_loss: 0.73804 - val_acc: 0.8088 -- iter: 1224/1224
--
Training Step: 7878  | total loss: 0.00451 | time: 75.050s
| Momentum | epoch: 200 | loss: 0.00451 - acc: 0.9998 -- iter: 1224/1224

由上述提示信息可见,经过200轮训练后,模型的准确率已经从 0.0630 达到 0.9998。而此时还未涉及到 R-CNN 的核心部分 - 候选框的提取。本文使用的是 Selective Search 算法,直接使用 pip install selectivesearch 进行下载即可,有兴趣的读者也可以自己编写python脚本。

3)执行如下命令,基于 flower2 数据集(标签既有类别,又有位置信息 [x,y,w,h])做 fine-tuning

python fine_tune_RCNN.py

fine_tune_Alexnet 函数如下所示:

 

 

 

 

def fine_tune_Alexnet(network, X, Y):
    # Training
    model = tflearn.DNN(network, checkpoint_path='rcnn_model_alexnet',
                        max_checkpoints=1, tensorboard_verbose=2, tensorboard_dir='output_RCNN')
    if os.path.isfile('fine_tune_model_save.model'):
        print("Loading the fine tuned model")
        model.load('fine_tune_model_save.model')
    # saver.restore(sess, './alexnet-cnn.model')
    elif os.path.isfile('model_save.model.meta'):
        print("Loading the alexnet")
        # saver = tf.train.Saver()
        try:
            model.load('model_save.model')
            print("successful loaded [model_save.model]...")
        except Exception as e:
            print(e)
            pass
        # saver.restore(model.session,'./model_save.model')
    else:
        print("No file to load, error")
        return False

    model.fit(X, Y, n_epoch=10, validation_set=0.1, shuffle=True,
              show_metric=True, batch_size=32, snapshot_step=200,
              snapshot_epoch=False, run_id='alexnet_rcnnflowers2')  # epoch = 1000
    # Save the model
    model.save('fine_tune_model_save.model')

fine-tuning 结束后,提示如下所示(会生成 fine_tune_model_save.model 的相关文件):

successful loaded [model_save.model]...
---------------------------------
Run id: alexnet_rcnnflowers2
Log directory: output_RCNN/
---------------------------------
Training samples: 2034
Validation samples: 226
--
Training Step: 8000  | total loss: 0.18893 | time: 112.817s
| Momentum | epoch: 002 | loss: 0.18893 - acc: 0.9366 | val_loss: 0.20319 - val_acc: 0.9336 -- iter: 1856/2034
--
Training Step: 8200  | total loss: 0.18021 | time: 4.906s8s
| Momentum | epoch: 006 | loss: 0.18021 - acc: 0.9413 | val_loss: 0.19566 - val_acc: 0.9336 -- iter: 0064/2034
--
Training Step: 8400  | total loss: 0.18054 | time: 20.381ss
| Momentum | epoch: 009 | loss: 0.18054 - acc: 0.9347 | val_loss: 0.16186 - val_acc: 0.9336 -- iter: 0320/2034
--
Training Step: 8518  | total loss: 0.11383 | time: 122.717s
| Momentum | epoch: 010 | loss: 0.11383 - acc: 0.9564 -- iter: 2034/2034


由上述提示信息可知,训练10轮后,模型的准确率为0.9564。适当增加epoch的值,再进行训练可以得到更优的效果。本人准备将epoch的值设置成1000再训练一次模型,感受一下效果。

至此,模型就已经训练好了。此处有点不同的是,该网络模型不是直接使用CNN后接softmax做分类,而是换成SVM。因为SVM适用于小样本训练,这里这么做可以提高准确率。详细的解释可以参考博文:http://blog.csdn.net/hjimce/article/details/50187029

训练SVM的代码如下所示:

# Construct cascade svms
def train_svms(train_file_folder, model):
    listings = os.listdir(train_file_folder)
    svms = []
    for train_file in listings:
        if "pkl" in train_file:
        continue
        X, Y = generate_single_svm_train(train_file_folder+train_file)
        train_features = []
        for i in X:
            feats = model.predict([i])
            train_features.append(feats[0])
    print("feature dimension")
        print(np.shape(train_features))
        clf = svm.LinearSVC()
        print("fit svm")
        clf.fit(train_features, Y)
    svms.append(clf)
    return svms
# Load training images
def generate_single_svm_train(one_class_train_file):
    trainfile = one_class_train_file
    savepath = one_class_train_file.replace('txt', 'pkl')
    images = []
    Y = []
    if os.path.isfile(savepath):
    print("restoring svm dataset " + savepath)
        images, Y = prep.load_from_pkl(savepath)
    else:
    print("loading svm dataset " + savepath)
        images, Y = prep.load_train_proposals(trainfile, 2, threshold=0.3, svm=True, save=True, save_path=savepath)
    return images, Y

generate_single_svm_train 函数分别根据 ./svm_train 目录下的 ”1.txt“和”2.txt“生成对应的”1.pkl“和”2.pkl“,都是很大的文件(> 1GB)。

测试结果

执行如下命令,作用包括:

- 训练 SVM

- 使用”testimg7.jpg“测试模型

python RCNN_output.py

此时,你可能会遇到如下问题:

Traceback (most recent call last):
  File "RCNN_output.py", line 151, in <module>
    pred = i.predict(f)
  File "/home/hcq/anaconda3/lib/python3.6/site-packages/sklearn/linear_model/base.py", line 324, in predict
    scores = self.decision_function(X)
  File "/home/hcq/anaconda3/lib/python3.6/site-packages/sklearn/linear_model/base.py", line 300, in decision_function
    X = check_array(X, accept_sparse='csr')
  File "/home/hcq/anaconda3/lib/python3.6/site-packages/sklearn/utils/validation.py", line 441, in check_array
    "if it contains a single sample.".format(array))
ValueError: Expected 2D array, got 1D array instead:
array=[-0.62386084  0.64800894  0.54052156 ...,  0.29537463  0.49037218
  0.40998983].
Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.

你需要在 RCNN_output.py 脚本里加一条语句 f = f.reshape(1, -1) ,如下所示:

if __name__ == '__main__':
    train_file_folder = 'svm_train/'
    img_path = 'testimg7.jpg'
    imgs, verts = image_proposal(img_path)
    net = create_alexnet(3)
    model = tflearn.DNN(net)
    model.load('fine_tune_model_save.model')
    svms = train_svms(train_file_folder, model)
    print("Done fitting svms")
    features = model.predict(imgs)  # 
    print("predict image:")
    print(np.shape(features))   # (107, 4096)
    results = []
    results_label = []
    count = 0
    for f in features:
        f = f.reshape(1, -1)    # add by hcq 20171128

        for i in svms:
            pred = i.predict(f)
            print(pred)
            if pred[0] != 0:
                results.append(verts[count])
                results_label.append(pred[0])
        count += 1
    print("result:")
    print(results)
    print("result label:")
    print(results_label)
    img = skimage.io.imread(img_path)
    fig, ax = plt.subplots(ncols=1, nrows=1, figsize=(6, 6))
    ax.imshow(img)
    for x, y, w, h in results:
        rect = mpatches.Rectangle(
            (x, y), w, h, fill=False, edgecolor='red', linewidth=1)
        ax.add_patch(rect)

    plt.show()

调试成功后,效果如下所示(此处使用的是经过200轮fine-tuning后的模型):




执行如下命令,加入非极大值抑制(nms)后的效果如下所示:

python RCNN_output_nms.py 





实践效果解释(后续补上)
实践过程中遇到的问题:
1)使用python2(建议使用python3):

restoring svm dataset svm_train/2.pkl
Traceback (most recent call last):
  File "RCNN_output.py", line 139, in <module>
    svms = train_svms(train_file_folder, model)
  File "RCNN_output.py", line 119, in train_svms
    X, Y = generate_single_svm_train(train_file_folder + train_file)
  File "RCNN_output.py", line 80, in generate_single_svm_train
    images, Y = prep.load_from_pkl(savepath)
  File "/home/hcq/document/deepLearning/github/rcnn-tflearn/preprocessing_RCNN.py", line 133, in load_from_pkl
    X, Y = pickle.load(open(dataset_file, 'rb'))
  File "/home/hcq/anaconda2/lib/python2.7/pickle.py", line 1384, in load
    return Unpickler(file).load()
  File "/home/hcq/anaconda2/lib/python2.7/pickle.py", line 864, in load
    dispatch[key](self)
  File "/home/hcq/anaconda2/lib/python2.7/pickle.py", line 892, in load_proto
    raise ValueError, "unsupported pickle protocol: %d" % proto
ValueError: unsupported pickle protocol: 3

解决方案:

http://blog.csdn.net/u013828589/article/details/72848192
https://stackoverflow.com/questions/25843698/valueerror-unsupported-pickle-protocol-3-python2-pickle-can-not-load-the-file
 

2)sklearn 工具包版本造成的问题:ValueError: Expected 2D array, got 1D array instead

Traceback (most recent call last):
  File "RCNN_output.py", line 149, in <module>
    pred = i.predict(f)
  File "/home/hcq/anaconda3/lib/python3.6/site-packages/sklearn/linear_model/base.py", line 324, in predict
    scores = self.decision_function(X)
  File "/home/hcq/anaconda3/lib/python3.6/site-packages/sklearn/linear_model/base.py", line 300, in decision_function
    X = check_array(X, accept_sparse='csr')
  File "/home/hcq/anaconda3/lib/python3.6/site-packages/sklearn/utils/validation.py", line 441, in check_array
    "if it contains a single sample.".format(array))
ValueError: Expected 2D array, got 1D array instead:
array=[-0.62386084  0.64800894  0.54052156 ...,  0.29537463  0.49037218
  0.40998983].
Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.

解决方案:

http://blog.csdn.net/llx1026/article/details/77940880

 

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

【object detection】RCNN 实践篇 - 使用 Alexnet 预训练 17-flower 数据集(17分类),使用 2-flower 数据集进行 fine-tuning 的相关文章

随机推荐

  • 自学c++笔记(三)

    笔记记录本人学习C 路上的一些摘要与总结 供本人阅读同时也分享与他人 转义序列 换行符 n 水平制表符 t 退格 b 回车 r 振铃 a wchar t 宽字符类型 是一种整型类型 使用wcin和wcout来处理wchar t流 const
  • 动态规划-砝码称重问题

    动态规划 Dynamic Programming 这个词乍一听感觉甚是高大上 初次学习或者使用的时候会感觉难以理解 这是正常的 毕竟凡事都是一回生二回熟 其实它也不难的 大家要明白一个道理 能写到课本上给学生学习的东西必然属于不难的东西 因
  • java中emptyMap()方法具有什么功能呢?

    转自 java中emptyMap 方法具有什么功能呢 下文笔者讲述emptyMap 方法的功能简介说明 如下所示 emptyMap 方法的功能 返回一个不变的空map emptyMap的语法 public static final Map
  • 物联网 MQTT 服务质量级别

    欢迎大家前往腾讯云 社区 获取更多腾讯海量技术实践干货哦 翻译人 Tnecesoc 该成员来自云 社区翻译社 消息队列遥测传输 MQTT 是一种客户端服务器发布 订阅消息传输协议 它轻量 开放 简单 其设计也易于实施 这些特性使其非常适合用
  • DETR系列:RT-DETR实战部署

    上篇文章介绍RT detr的论文内容 RT DETR 论文解析 本篇文章介绍算法复现 tensorRT加速 python代码部署tensorRT测试单张图片或文件夹 RT DETR实战部署 1 复现模型详情 2 环境准备 3 训练 4 部署
  • VirtualBox 共享文件夹设置 及 开机自动挂载

    鉴于支付宝等服务无视我们Linux用户的存在 没办法 那只好在Linux上用VirtualBox虚拟一个Windows系统了 系统装好了 在日常使用过程中 往往要从 VirtualBox的客户机 guest system 中使用主机 hos
  • 第一列有0时存成csv0消失的解决方法

    df 带零列 t df 带零列
  • python初学者(四)---键值对

    这篇文章先来说一下python的键值对 即字典形式 举个栗子 info stu110 tengxun stu112 baidu stu113 alibaba 这就是python的键值对形式 前面为key 后面为values 声明一点的是 键
  • Pytorch深度学习(四):用Pytorch实现线性回归

    用Pytorch实现线性回归 一 概念 1 准备数据集 2 使用Class设计模型 3 构建损失函数和优化器的选择 4 进行训练的迭代 二 完整代码如下 一 概念 上图主要介绍了使用Pytorch解决问题的四个步骤 1 准备数据集 1 准备
  • Android java.lang.RuntimeException: Parcelable encountered IOException writing serializable object 解

    Android中的Activity传递数据时 为了方便往往将很多数据封装成对象 然后将整个对象传递过去 传对象的时候有两种情况 一种是实现Parcelable接口 一种是实现Serializable接口 可以用bundle putSeria
  • 学习链表必备的1w个技巧Java版本

    链表 关于作者 作者介绍 博客主页 作者主页 简介 JAVA领域优质创作者 一名在校大三学生 在校期间参加各种省赛 国赛 斩获一系列荣誉 关注我 关注我学习资料 文档下载统统都有 每日定时更新文章 励志做一名JAVA资深程序猿 简介 链表是
  • oracle如何删除重复的记录,oracle查找及删除重复记录的几种方法

    一 oracle查找重复记录的几种方法 1 查找大量重复记录 select empno from emp a group by empno having count gt 1 select from emp a where rowid no
  • 漂亮~阿里P8整理总结,金九银十入职大厂必备的Java核心知识点,附加面试题+答案解析

    前言 金九银十就要来了 不知道程序员们都准备好了吗 今天就给大家分享一波一位小伙伴面试大厂的经历 知识点和面试题分享 主要内容包括 JVM JAVA集合 JAVA多线程并发 JAVA基础 Spring原理 微服务 Netty与RPC 网络
  • STM32芯片3.3V IO口驱动MOS管电路

    Nmos管做低端驱动 电路工作原理说明 对于Nmos管 G极电位比S极电位高于导通域值电压便会导通 对于Pmos管则相反 G极电位比S极电位低于导通域值电压才会导通 所以Nmos管适合做低端驱动 S极接地 以使S极的电压固定 Pmos管适合
  • 七牛云详细教程(包含与阿里云建立连接)

    七牛云详细教程 包含与阿里云建立连接 1 七牛云简介 不管是设计师 还是开发者 亦或是个人 公司 我们有时会需要将图片存在网络上 然后用链接来分享给他人 或是 用来给网站做图片外链 通过CDN加速 新浪 QQ 百度等等公司基本都做了防盗链
  • android源码linux环境配置及其编译方法

    安装依赖libs sudo apt get install openjdk 11 jdk 安装jdk sudo apt get install libx11 dev i386 libreadline6 dev i386 libgl1 mes
  • Mysql之分组查询

    学习目标 能够写出分组查询的SQL语句 1 分组查询介绍 分组查询就是将查询结果按照指定字段进行分组 字段中数据相等的分为一组 分组查询基本的语法格式如下 GROUP BY 列名 HAVING 条件表达式 WITH ROLLUP 说明 列名
  • linux命令stat,Linux stat命令的使用

    1 命令简介 stat命令用于显示文件或文件系统的详细信息 在显示文件信息时 比ls命令更加详细 2 命令格式 3 命令选项 4 常用示例 1 显示文件信息 信息解释 File Changelog 文件名称为Changelog Size 1
  • 米尔基于STM32MP135核心板,助力充电桩发展

    随着电动车的普及和人们环保意识的增强 充电桩作为电动车充电设备的重要一环 充电桩行业正迅速发展 消费市场的大量应用也造就市场的需求量不断增长 因此 产品的功能 可靠性 安全性等要求也变得尤为重要 而采用传统单片机产品并不能满足充电桩的智能控
  • 【object detection】RCNN 实践篇 - 使用 Alexnet 预训练 17-flower 数据集(17分类),使用 2-flower 数据集进行 fine-tuning

    前言最近根据制定的 Deep Learning 学习计划 11月份的主要任务是 熟悉各大DL网络模型 主要以分类和检测为主 看论文 熟悉病理数据等 我们有一个2人组的小分队 我这个月的主要工作集中在学习目标检测的经典算法以及基于tensor