- 博客(17)
- 收藏
- 关注
原创 Python程序打包成Docker镜像
一、简单python 例如test.py,要在run一个容器时输出hello world! print('hello world!') 创建Dockerfile FROM ubuntu:18.04 # 基础镜像ubuntu18.04 RUN apt update && \ apt install -y python3 # 安装python3 RUN mkdir /workspace # 创建文件夹 COPY test.py
2021-07-30 11:05:45
1424
原创 Ubuntu 20.04 + RTX 3090显卡配置TensorFlow
Ubuntu 20.04 + RTX 3090显卡配置TensorFlow安装文件安装步骤 经历了多次尝试后,终于让RTX 3090跑起来了。Ubuntu 20.04 + RTX 3090 + CUDA 11.2 + cuDNN 11.2 + Python 3.7 + TensorFlow 2.5.0rc3,亲测有效。步骤如下: 安装文件 cuda_11.2.1_460.32.03_linux.run,下载链接:link cudnn-11.2-linux-x64-v8.1.1.33.tgz,下载链接:li
2021-05-10 22:34:53
2170
原创 Windows 10配置TensorFlow 2 GPU版本
Windows 10配置TensorFlow-gpu 2.2.0 Windows 10环境下配置TensorFlow-gpu 2.2.0(Nvidia 10/20系显卡适用),已在台式机(GTX 1070Ti)和笔记本(RTX 2070 MAX-Q)上验证。 安装Visual Studio 2015及两个运行库vc_redist.x64.exe和vc_redist.x86.exe; 安装CUDA 10.1和cuDNN 7.6.5; 安装Anaconda3 (Python 3.7版本的); 安装/升级依赖的
2021-04-01 17:30:44
227
原创 图像转成tfrecords很大的问题
tfrecords文件过大问题使用默认方式将图像转成tfrecords文件很大 使用默认方式将图像转成tfrecords文件很大 解决方法:构造writer时,加上options参数—— options = tf.python_io.TFRecordOptions(compression_type=tf.python_io.TFRecordCompressionType.ZLIB) writer = tf.python_io.TFRecordWriter(tfrecords_path, options)
2021-01-11 17:06:31
476
原创 本地项目上传Gitee简单示例
Win10将本地小项目上传到Gitee下载和安装Git创建仓库上传本地项目 下载和安装Git 官网下载git:git官方下载链接。根据安装提示和自己的需求安装即可。 创建仓库 上Gitee(Gitee官网,没有账号注册一个)创建一个仓库(master),例如名为:Hello,仓库链接就是:https://gitee.com/xxx/hello,xxx为Gitee用户名。 上传本地项目 1.进入本地项目文件夹下,右键鼠标Git Bash Here,输入命令: git init 例如本地文件夹是"G:\Gi
2021-01-06 16:26:46
297
原创 TensorFlow 2模型训练model.fit()与model.fit_generator()
model.fit与model.fit_generator适用情况示例model.fit()示例model.fit_generator() 适用情况 model.fit()适用于数据集比较小,一次性读入所有数据内存不会溢出; model.fit_generator()适用于数据集大,内存容易溢出; 如果有数据增广,也采用fit_generator()。 示例model.fit() 数据量不大,可以一次性读入所有数据。 preprocess_image()和preprocess_label()是根据路径读取图
2020-12-17 18:43:14
5718
原创 TensorFlow 2.X GPU显存问题
TensorFlow 2.X训练时GPU显存分配 TensorFlow 2.X训练时,默认状态下GPU显存只能分配82%左右(笔者电脑为RTX 2070 Max-Q 8GB,Windows 10,CUDA 10.1,cuDNN 7.6,TensorFlow 2.1.0)。 很多博客给出如下的代码: gpus = tf.config.experimental.list_physical_devices('GPU') for gpu in gpus: tf.config.experime
2020-12-17 17:28:36
1071
原创 TensorFlow将meta转化为summary,从ckpt查看tensor的name
meta转化为summary用tensorboard查看 import tensorflow as tf from tensorflow.python.platform import gfile graph = tf.get_default_graph() graphdef = graph.as_graph_def() _ = tf.train.import_meta_graph('meta的路...
2019-12-25 21:51:30
398
原创 TensorFlow slim代码示例
slim代码示例,包括读取tfrecords,带BN的训练,L2正则化 读取tfrecords import glob import cv2 import numpy as np import tensorflow as tf # 从自定义的config.py里导入一些参数 from config import HEIGHT, WIDTH, CHANNEL def read(file_queue...
2019-12-25 21:37:39
318
原创 开源项目到github
将自己的项目放到github 最近做了一个小项目,学着将代码及其它文件托管到github。 第一步 注册github,下载并安装git 第二步 在github主页上create a new repository 第三步 在自己的项目文件夹下右键,打开git bash here (如果已安装git), 依次使用指令: git init git add . (注意有个点 . 表示文件夹中所有内...
2019-06-29 14:33:51
319
原创 TensorFlow实现反池化
TensorFlow实现2×2反池化 2×2反池化 如下图,将输入的尺寸扩大为原来两倍,输入值填充到新的每个2×2网格的左上角,其余三个填0。 代码实现 TensorFlow中没有反池化函数,以下是代码实现。 # 2x2反池化 def unpool(value, name='unpool'): with tf.name_scope(name) as scope: sh =...
2019-04-29 16:28:51
1455
2
原创 TensorFlow实现batch_borm
TensorFlow实现batch_borm def batch_norm(x, is_training, eps=EPS, decay=0.9, affine=True, name='batch_norm'): from tensorflow.python.training.moving_averages import assign_moving_average ...
2019-04-28 16:36:51
245
原创 TensorFlow slim中正则化的使用
TensorFlow slim中正则化的使用 关于slim中的正则化使用,以L2正则化为例: # 构建网络时候添加l2正则化 with slim.arg_scope([slim.conv2d], weights_regularizer=slim.l2_regularizer(0.0001)): net = slim.conv2d(inputs, 64, 5, 2, padding='SAME',...
2019-04-05 21:54:08
478
原创 TensorFlow模型变量重用
TensorFlow模型变量重用问题 加载模型及检测的.py # predict.py import numpy as np import tensorflow as tf from PIL import Image import time import fcrn def predict(model_data_path, image_path , png_path): # Defau...
2018-11-28 12:04:52
980
1
原创 TensorFlow用GPU训练
TensorFlow用GPU训练 #配置GPU config = tf.ConfigProto() config.gpu_options.per_process_gpu_memory_fraction = 0.7 # 显存占用率 config.allow_soft_placement = True config.log_device_placement = True config.gpu_opt...
2018-11-24 10:44:06
2381
原创 C++获取指定文件夹下的文件名(含路径)
C++获取指定文件夹下的文件名(含路径) 代码 // 类声明 #pragma once #include <iostream> #include <string> #include <string.h> #include "cstdlib" #include "direct.h" #include &am
2018-10-13 23:22:28
6992
1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅