![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
深度学习
木里先森
中山大学||北京邮电大学
展开
-
数据集中图像裁剪scale大小
数据集中图像裁剪scale大小: {256,384,512,640,748}原创 2022-02-17 20:39:53 · 395 阅读 · 0 评论 -
AttributeError: module ‘torch.nn‘ has no attribute ‘GELU‘
class GELU(nn.Module): def forward(self, input): return F.gelu(input)nn.GELU() ⇒ GELU()原创 2021-12-25 10:46:29 · 4454 阅读 · 0 评论 -
利用try-except解决数据流破损的问题
解决数据流破损的问题 def get(self, item): filename = item['file_name']# print("item['labels']: ", item['labels']) # item['labels']: [2, 36, 9, 49, 21] labels = sorted(item['labels']) # 排序# print("labels: ", labels )原创 2021-11-18 22:20:14 · 617 阅读 · 0 评论 -
python代码实现global top-k pooling
python代码实现global top-k pooling:#!/usr/bin/env python3# -*- coding: utf-8 -*-"""Created on Sat Sep 11 11:25:46 2021@author: muli"""import torchfrom torch import nnclass TopKPool(nn.Module): def __init__(self, k): super(TopKPool, self原创 2021-09-11 20:13:07 · 962 阅读 · 0 评论 -
报错:RuntimeError: cuda runtime error (100) : no CUDA-capable device is detected at /pytorch/aten/src/
no CUDA-capable device ,可能原因时没有torch-GPU在代码中指定了GPU(多卡情况下),而单卡中是 ‘0’ os.environ["CUDA_VISIBLE_DEVICES"] = '1' 将 os.environ[“CUDA_VISIBLE_DEVICES”] = ‘1’ 修改为 os.environ["CUDA_VISIBLE_DEVICES"] = '0' 或者注释该行代码最后,附上pytorch自查代码:..原创 2020-11-03 21:38:26 · 4828 阅读 · 0 评论 -
MS-COCO2014数据集标签互译
MS-COCO2014数据集标签互译['person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'train', 'truck', 'boat', 'traffic light', 'fire hydrant', 'stop sign', 'parking meter', 'bench', 'bird', 'cat', 'dog...原创 2019-11-12 21:43:53 · 881 阅读 · 0 评论 -
深度学习的小结
迁移学习的定义:在 ImageNet 已经得到一个预训练好的 ConvNet 网络,删除网络的最后一个全连接层,然后将 ConvNet 网络的剩余部分作为新数据集的特征提取层。一旦你提取了所有图像的特征,就可以开始训练新数据集分类器。微调:更换并重新训练 ConvNet 的网络层,还可以通过反向传播算法对预训练网络的权重进行微调。...原创 2019-05-26 20:57:42 · 845 阅读 · 0 评论 -
报错:tensorflow.InvalidArgumentError: Input reshape is 7680 values, but the requested shape has 768
报错:tensorflow.python.framework.errors_impl.InvalidArgumentError: Input to reshape is a tensor with 76800 values, but the requested shape has 768 print("auxiliary_tensor:",auxiliary_tensor) # ...原创 2019-06-05 20:00:30 · 2959 阅读 · 2 评论 -
读取classify_image_graph_def.pb的tensor name
# -*- coding: utf-8 -*-import tensorflow as tfimport osmodel_dir = 'Inception_model'model_name = 'classify_image_graph_def.pb'# 读取并创建一个图graph来存放Google训练好的Inception_v3模型(函数)def create_graph():...原创 2019-06-01 10:45:46 · 886 阅读 · 1 评论 -
tensorflow读取VGG16.npy文件中卷积层和全连接层参数
# -*- coding: utf-8 -*- import numpy as np data_dict = np.load('vgg16.npy', encoding='latin1').item()# 键值对的形式存在# print("data_dict:",data_dict)# print("**********************************")keys ...原创 2019-05-29 20:12:03 · 1718 阅读 · 1 评论 -
图像多标签标注准确率(accuracy)、精确率(precision)、召回率(recall)和F1值计算
参考链接:https://blog.csdn.net/weixin_41650458/article/details/82555775#!/usr/bin/env python3# -*- coding: utf-8 -*-"""Created on Thu Jun 13 21:09:48 2019@author: muli"""import numpy as np #y_t...原创 2019-06-13 21:27:47 · 5830 阅读 · 7 评论 -
Image Annotation图像标注小结
1:标签关系----《Learning Structured Inference Neural Networks with Label Relations》2016–黄鹤翔–邓志伟–学习具有标签关系的结构化推理神经网络标签之间是有一定关系的;标签之间的关系可以形成一个复杂的网络;可以形成不同层次的解释来表示这样的图像模型的要求包括:(1)能够对标签-标签关系(如正相关或负相关)建模;(2)...原创 2019-05-10 10:34:03 · 3042 阅读 · 8 评论 -
深度学习的一些总结
转载:16组-Going Deeper with Convolutions 阅读笔记 **链接:**https://www.jianshu.com/p/ae5c9a0db8b9转载 2019-04-29 14:38:07 · 321 阅读 · 0 评论 -
show and tell 用tensorflow实现
训练集下载地址:http://msvocds.blob.core.windows.net/coco2014/train2014.zip验证集下载地址:http://msvocds.blob.core.windows.net/coco2014/val2014.zip图像描述下载地址:http://msvocds.blob.core.windows.net/annotations-1-0-3...原创 2019-03-27 19:26:08 · 676 阅读 · 1 评论 -
深度学习中的目标检测--tensorflow-gpu--API--验证过程及结果表示
深度学习中的目标检测–tensorflow-gpu–API–验证过程及结果表示voc/export下的frozen_inference_graph.pb 文件就是我们宝贵的,最终要的模型文件执行命令:python eval.py --eval_dir=voc/eval_dir/ --pipeline_config_path=voc/voc.config --checkpoint_d...原创 2019-03-26 19:48:53 · 587 阅读 · 0 评论 -
Tensoeflow官方文档research下各个文件夹的含义
Tensoeflow官方文档research下各个文件夹的含义**official文件夹是官方例程API的集合,都已经经过了优化和稳定性测试。**object detection是基于slim模型分类后的目标识别。research文件夹API如下:adversarial_crypto:用对抗性神经密码术保护通信。adversarial_text:带有对抗训练的半监督序列学习。atten...原创 2019-03-26 14:43:25 · 380 阅读 · 0 评论 -
深度学习中的目标检测--tensorflow-gpu--API--测试单张图像的脚本程序
深度学习中的目标检测–tensorflow-gpu–API–测试单张图像的脚本程序#encoding:utf-8import tensorflow as tfimport numpy as np import osfrom matplotlib import pyplot as pltfrom PIL import Imagefrom object_detection.util...原创 2019-03-26 10:35:45 · 611 阅读 · 0 评论 -
Image Caption图像描述总结
现有的解决图像描述任务的算法大致可以分为三类 :基于模板式的 、基于相似空间检索式的 、基于多模翻译式的 。现有的生成图像描述的形式大致也可分为三类 :单 句子式描述 ,密集型描述,多语言描述。...原创 2019-03-18 14:28:36 · 5694 阅读 · 0 评论 -
tensorflow中对指定变量进行初始化
获取未初始化的变量集合print(sess.run(tf.report_uninitialized_variables()))例如我的:[b’Conv2d_1b_1x1/weights’ b’Conv2d_1b_1x1/biases’ b’Conv2d_2a_5x5/weights’ b’Conv2d_2a_5x5/biases创建所有变量集合:lac_var=[]获取所有变量:...原创 2019-06-08 11:08:23 · 1535 阅读 · 0 评论 -
tf.placeholder_with_default案例
#!/usr/bin/env python3# -*- coding: utf-8 -*-"""Created on Fri Jun 7 11:17:10 2019@author: muli"""import tensorflow as tfimport numpy as npdef mand(a): # tf.placeholder_with_default ...原创 2019-06-08 11:28:50 · 2553 阅读 · 0 评论 -
AP和mAP 计算:sklearn.metrics.average_precision_score()
函数:sklearn.metrics.average_precision_score(y_true, y_score, average=‘macro’, sample_weight=None)根据预测得分计算平均精度(AP),此分数对应于精确召回曲线下的区域y_true : array, shape = [n_samples] or [n_samples, n_classes]真实标签:取...原创 2019-09-28 15:04:26 · 13581 阅读 · 2 评论 -
pytorch打印自定义网络的每层的名称
pytorch打印自定义网络的每层的名称import torchfrom torchvision import modelsfrom torchsummary import summaryfrom resnext_MulTask_clothes import resnext50_elasticdata_class=[8, 7]device = torch.device('cuda'...原创 2019-09-14 20:19:57 · 5659 阅读 · 0 评论 -
计算CP、CR、CF1、OP、OR、OF1和mAP的top-3评价指标
计算CP、CR、CF1、OP、OR、OF1和mAP评价指标# -*- coding: utf-8 -*-import numpy as np# CP CR CF1 OP OR OF1 mAP 的函数返回值def calculate_metrics(labels, preds): mAP = calculate_mAP(labels, preds) pc_top3, r...原创 2019-09-17 22:07:35 · 3086 阅读 · 0 评论 -
keras里面tensorflow版ResNet101源码分析
keras里面tensorflow版ResNet101源码分析"""Adapted from https://gist.github.com/flyyufelix/65018873f8cb2bbe95f429c474aa1294改编自 flyyufelix注意:keras支持的Tensorflow----Using TensorFlow backend(需要修改相应的配置文件)ker...原创 2019-08-17 17:47:08 · 2516 阅读 · 0 评论 -
MSCOCO2014数据集与MSCOCO2017数据集比较
MSCOCO2014数据集与MSCOCO2017数据集比较MSCOCO2014数据集:训练集: 82783张,13.5GB, 验证集:40504张,6.6GB,共计123287张MSCOCO2017数据集:训练集:118287张,19.3GB, 验证集: 5000张,1814.7M,共计123287张...原创 2019-08-05 21:33:09 · 13129 阅读 · 5 评论 -
Keras报错:You are trying to load a weight file containing 0 layers into a model with 16 layers.
报错如下:Traceback (most recent call last):File “demo/demo_train_miml_vgg.py”, line 27, in base_model = VGG_16(vgg_model_path)File “lib/cocodemo/vgg_16.py”, line 56, in VGG_16model.load_weights(weigh...原创 2019-07-22 21:57:36 · 2907 阅读 · 4 评论 -
keras里面报错assert _image_data_format in {'channels_last', 'channels_first'} AssertionError
报错如下:Traceback (most recent call last):File “demo/demo_train_miml_vgg.py”, line 2, in from keras.layers import DropoutFile “/home/muli/.conda/envs/python2/lib/python2.7/site-packages/keras/init.py...原创 2019-07-22 21:36:10 · 969 阅读 · 0 评论 -
ResNet 各个版本 tensorflow下载
ResNet 各个版本 tensorfolw下载:下载链接:https://github.com/keras-team/keras-applications/releases/tag/resnetresnet101v2_weights_tf_dim_ordering_tf_kernels.h5 171 MBresnet101v2_weights_tf_dim_ordering_tf_k...原创 2019-07-25 11:06:32 · 4197 阅读 · 2 评论 -
keras1.2.2报错 "Flatten" is not fully defined (got (0, 7, 512). "input_shape" or "batch_input_shape"
keras1.2.2里面报错如下:File “demo/demo_train_miml_vgg.py”, line 28, in base_model = VGG_16(vgg_model_path)File “lib/cocodemo/vgg_16.py”, line 49, in VGG_16model.add(Flatten())File “/home/muli/.conda/en...原创 2019-07-23 19:01:30 · 1008 阅读 · 0 评论 -
python实现汉明损失(hamming_loss)、0-1 损失(zero_one_loss)、覆盖误差(coverage_error)、排名损失(label_ranking)以及平均精度损失
python实现汉明损失(hamming_loss)、0-1 损失(zero_one_loss)、覆盖误差(coverage_error)、排名损失(label_ranking)以及平均精度损失# -*- coding: utf-8 -*-"""Created on Thu Jul 18 15:26:34 2019@author: muli"""import numpy as np...原创 2019-07-18 20:29:08 · 5708 阅读 · 2 评论 -
ubantu中为每个文件夹里面的文件生成对应的txt文件,内容为文件夹的名字
参考连接:https://blog.csdn.net/banana1006034246/article/details/791604600:将同一类别的不同图片放在一个目录下,将此文件放在此目录下执行,为每张图片生成txt文件,内容就是目录的名字,txt文件 保存在 文件夹 1-image_labels_dir 里面1:文件夹为一个类别,如: Adir=$(cd "$(dirname "...原创 2019-06-29 22:26:14 · 401 阅读 · 0 评论 -
MIL多示例学习的理解
我们就拿图像分类举个例子:图像分类是基于图像内容来确定图像目标的类别。例如:一张图片上存在"sand"、“water"等各种示例,我们研究的目标是"beach”。在多示例学习中,一张图像作为一个"包":X={X1,X2,X3, …, Xn}。Xi是特征向量(也就是我们所说的示例),是从图像中对应的第i个区域中提取出来的,总共存在N个示例区域。那么,"包"中当且仅当"sand"和"water"都存...原创 2019-07-09 16:49:25 · 3085 阅读 · 0 评论 -
报错:Tensorflow object detection 里面resize_images() got an unexpected keyword argument 'preserve_aspect
报错:TypeError: resize_images() got an unexpected keyword argument ‘preserve_aspect_ratio’知道解决方法,请告知File “/home/muli/Faster-R-CNN/models/research/object_detection/core/preprocessor.py”, line 2263, i...原创 2019-03-15 17:39:56 · 4708 阅读 · 24 评论 -
Tensorflow使用LSTM模型中的多变量时间序列预测
Tensorflow使用LSTM模型中的多变量时间序列预测# Copyright 2017 The TensorFlow Authors. All Rights Reserved.## Licensed under the Apache License, Version 2.0 (the "License");# you may not use this file except in ...原创 2019-03-08 10:31:19 · 4946 阅读 · 0 评论 -
TensorFlow实战框架Chp10--Keras使用RNN处理情感分析问题
Keras使用RNN处理情感分析问题# -*- coding: utf-8 -*-"""Created on Tue Jul 10 20:33:30 2018@author: muli"""from keras.preprocessing import sequencefrom keras.models import Sequentialfrom keras.layers...原创 2018-07-10 21:47:56 · 487 阅读 · 0 评论 -
TensorFlow实战框架Chp10--Keras在MNIST数据集上实现LeNet-5模型
Keras在MNIST数据集上实现LeNet-5模型# -*- coding: utf-8 -*-"""Created on Tue Jul 10 20:04:03 2018@author: muli"""import kerasfrom keras.datasets import mnistfrom keras.models import Sequentialfrom...原创 2018-07-10 21:45:06 · 857 阅读 · 0 评论 -
TensorFlow实战框架Chp6--tf.nn.drop函数解析
tf.nn.dropout是TensorFlow里面为了防止或减轻过拟合而使用的函数,它一般用在全连接层tf.nn.drop(x, keep_prob, noise_shape=None, seed=None,name=None)x: 输入值keep_prob: float类型,每个元素被保留下来的概率noise_shape: 一个1维的int32张量,代表了随机产生“保留/丢...原创 2018-07-03 19:35:29 · 512 阅读 · 0 评论 -
TensorFlow实战框架Chp10--利用TFLearn在MNIST数据集上实现LeNet-5模型
利用TFLearn在MNIST数据集上实现LeNet-5模型 # -*- coding: utf-8 -*-"""Created on Mon Jul 9 22:37:34 2018@author: muli"""import tflearnfrom tflearn.layers.core import input_data, fully_connectedfrom t...原创 2018-07-10 10:55:41 · 290 阅读 · 0 评论 -
TensorFlow实战框架Chp10--利用TensorFlow-Slim在MNIST数据集上实现LeNet-5模型
TensorFlow-Slim在MNIST数据集上实现LeNet-5模型# -*- coding: utf-8 -*-"""Created on Mon Jul 9 22:00:18 2018@author: muli"""import tensorflow as tfimport tensorflow.contrib.slim as slimfrom tensorflo...原创 2018-07-10 10:53:05 · 936 阅读 · 0 评论 -
TensorFlow实战框架Chp3完整神经网络样例代码
TensorFlow实战框架Chp3完整神经网络样例代码# -*- coding: utf-8 -*-"""Created on Thu Jun 28 10:40:12 2018@author: muli"""import tensorflow as tffrom numpy.random import RandomStatebatch_size = 8w1= ...原创 2018-06-28 11:10:48 · 172 阅读 · 0 评论