- 博客(31)
- 收藏
- 关注
原创 视频转成图片
import cv2import scipy.miscvideo = cv2.VideoCapture('./film_frame_out.mp4')success = Truecount = 0path = './film_frame_out'while success: count += 1 success, img = video.read() scipy.misc.imsave(path+'/'+str(count)+'.png', cv2.cvtColor(im
2020-09-02 13:40:54 206
原创 图片转成视频
视频拆帧import cv2import scipy.miscvideo = cv2.VideoCapture('./film_frame_out.mp4')success = Truecount = 0path = './film_frame_out'while success: count += 1 success, img = video.read() scipy.misc.imsave(path+'/'+str(count)+'.png', cv2.cvtCol
2020-09-02 13:33:26 339
原创 简单网络爬虫
简单网络爬虫import requestsimport reimport osimport time# 请求网页headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36'}response = requests.get('https://www.sohu.com
2020-06-28 14:24:44 295
原创 多模态多类别数据可视化
多模态多类别数据可视化from time import timeimport numpy as npimport matplotlib.pyplot as pltfrom mpl_toolkits.mplot3d.axes3d import Axes3Dfrom sklearn import (manifold, datasets, decomposition, ensemble, ra...
2019-09-27 20:03:02 1013
翻译 t-sne降维处理
from time import timeimport numpy as npimport matplotlib.pyplot as pltfrom mpl_toolkits.mplot3d.axes3d import Axes3Dfrom sklearn import (manifold, datasets, decomposition, ensemble, lda,random_pro...
2019-04-12 09:39:49 443
翻译 Peak Signal to Noise Ratio/Structure Similarity
import matplotlib.image as mpimgimport numpy as npdef PSNRLossnp(y_true,y_pred): return 10* np.log(255*2 / (np.mean(np.square(y_pred - y_true)))) def SSIMnp(y_true , y_pred): u_true = np....
2019-04-12 09:38:34 228
原创 读入excel文件并且绘出折线图
![图片是这样的格式](https://img-blog.csdnimg.cn/20190128151550308.png)import pandas as pdimport matplotlib as mbimport matplotlib.pyplot as pltxls = pd.read_excel('./a.xls',sheetname="Sheet1");a=xls['i...
2019-01-28 15:16:42 436
翻译 解决tensorflow的问题
Q1:InvalidArgumentError (see above for traceback): Cannot assign a device for operation ‘IteratorGetNext’: Could not satisfy explicit device specification ‘/device:GPU:0’ because no supported kernel f...
2018-11-27 15:08:39 500
翻译 神经网络可视化
from vis.utils import utils# Activations are used through an Activation Layer. from keras import activationsfrom keras.applications import VGG16# Build the VGG16 network with ImageNet weightsmo...
2018-11-24 14:46:39 564
原创 提取真实的图片
import osimport shutilpath="./images";p=os.walk(path);real_file=[];for root,dirs,file in p: for f in file: if f.split("_")[1]=="real" and f.split(".")[0].split("_")[-1]=="A": real_fil
2018-11-23 14:54:06 171
原创 批量图片重命名
import ospath="./datasets/fake"filelist=os.listdir(path);count=1;for item in filelist: if item.endswith(".png"): src=os.path.join(os.path.abspath(path),item); dst=os.path.join...
2018-11-01 14:36:58 300
原创 显示数据集
from keras.datasets import cifar10(x_train,y_train),(x_test,y_test)=cifar10.load_data();import matplotlib.pyplot as pltdef plot_images_labels_prediction(images,labels,idx,num=10): fig=plt.gcf...
2018-10-09 14:08:45 246
翻译 keras实战cifar10数据集
from keras.datasets import cifar10import numpy as npnp.random.seed(10);(x_Train,y_Train),(x_Test,y_Test)=cifar10.load_data();print("train data:","images:",x_Train.shape,"labels:",y_Train.shape);...
2018-10-09 09:19:35 956 1
翻译 TensorFlow断点处理
//saverimport tensorflow as tfv1=tf.Variable(tf.constant(1.0,shape=[1]),name='v1');v2=tf.Variable(tf.constant(2.0,shape=[1]),name='v2');result=v1+v2;init_op=tf.initialize_all_variables();saver...
2018-10-08 09:09:04 533
翻译 linux下安装anaconda并启动Jupyter Notebook
wget anaconda*.shbash anaconda*.sh -bsudo gedit ~/.bashrcexport PATH="/home/user/anaconda3/bin:$PATH"
2018-10-08 09:08:57 14367
翻译 导出pb模型和导入pb模型
**//导出pb模型**import tensorflow as tffrom tensorflow.python.framework import graph_utilv1=tf.Variable(tf.constant(1.0,shape=[1]),name='v1');v2=tf.Variable(tf.constant(2.0,shape=[1]),name='v2');res...
2018-10-08 09:08:47 2764
翻译 windows下在anaconda下建立虚拟python环境
md \pythonwork && cd \pythonworkconda create --name tensorFlow python=3.5 anacondaactivate tensorFlowdeactivate tensorFlow
2018-10-08 09:08:38 869
翻译 Keras多层感知器识别手写数字
from keras.utils import np_utilsimport numpy as npnp.random.seed(10);from keras.datasets import mnist(x_train_image,y_train_label),(x_test_image,y_test_label)=mnist.load_data();# 特征值进行reshapex...
2018-10-08 09:08:21 266
翻译 keras卷积神经网络识别手写体
from keras.datasets import mnistfrom keras.utils import np_utilsimport numpy as npnp.random.seed(10);(x_Train,y_Train),(x_Test,y_Test)=mnist.load_data();print("done");x_Train4D=x_Train.reshape(...
2018-10-08 09:08:09 341
翻译 生成pb文件
from PIL import Imageimport numpy as npimport matplotlib.pyplot as pltimport matplotlib.image as mpimgimport tensorflow as tfimport osimport globfrom skimage import io, transformfrom tensorflo...
2018-10-07 10:25:15 857
翻译 完整自编码器
import tensorflow as tfimport tensorflow.contrib.slim as slimfrom tensorflow.examples.tutorials.mnist import input_dataimport numpy as npimport matplotlib.pyplot as pltmnist=input_data.read_data...
2018-10-07 10:23:37 138
翻译 Mnistinfogan
import numpy as npimport tensorflow as tfimport matplotlib.pyplot as pltfrom scipy.stats import normimport tensorflow.contrib.slim as slimfrom tensorflow.examples.tutorials.mnist import input_da...
2018-10-07 10:21:41 491
翻译 下载Inception
import tensorflow as tfimport requestsimport osimport tarfileinception_url="http://download.tensorflow.org/models/image/imagenet/inception-2015-12-05.tgz";inception_url_dir="model/";if not os.p...
2018-10-07 10:16:36 545
翻译 利用tensorflow对jpeg格式图像编码解码操作
import tensorflow as tfimport matplotlib.pyplot as pltimport globfrom skimage import ioimage_raw_data=tf.gfile.FastGFile('flower/daisy/5547758_eea9edfd54_n.jpg','rb').read();with tf.Session() as...
2018-10-07 10:15:08 1520
翻译 tensorflow实现迁徙学习
import globimport os.pathimport randomimport tensorflow as tffrom tensorflow.python.platform import gfile#Inception-V3模型瓶颈层的节点个数BOTTLENECK_TENSOR_SIZE=2048;#Inception模型中代表瓶颈层结果的张量的名称,在谷歌提供的模型中...
2018-10-07 10:13:27 191
翻译 tensorflow处理图像函数
import matplotlib.pyplot as plt;import tensorflow as tf;img_raw = tf.gfile.FastGFile('path/output.jpg', 'rb').read()img = tf.image.decode_jpeg(img_raw)img = tf.image.convert_image_dtype(img, dtyp...
2018-10-07 10:12:16 177
翻译 MNIST无监督学习-自编码器
import tensorflow as tffrom tensorflow.examples.tutorials.mnist import input_dataimport numpy as npimport matplotlib.pyplot as pltmnist=input_data.read_data_sets("mnist",one_hot=True);#设置超参数lea...
2018-10-07 10:10:34 692 1
翻译 将数据集转化为tfrecord并读取tfrecord
**//将数据集转化为tfrecord** import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data import numpy as np def _int64_feature(value): ...
2018-10-07 10:06:21 2090
翻译 读取图片生成标签
import osfrom skimage import io,transformimport globimport numpy as nppath="flower/";h=224;w=224;c=3;pathname=[path+x for x in os.listdir(path)];print(pathname);count=0;imgs=[];labels=[]...
2018-10-07 09:59:20 535
原创 安装TensorFlow-
安装tensorflow-gpu:1、安装cuda-repo-9.0.debsudo dpkg -i cuda*sudo apt-key add /var/cuda-repo-/7fa2af80.pub`sudo apt-get updatesudo apt-get install cuda2、export PATH=/usr/local/cuda-9.0/bin:PATHexpor...
2018-09-29 22:45:07 116
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人