tensorflow

Tensorflow: How can I assign numpy pre-trained weights to subsections of graph?

▼魔方 西西 提交于 2021-02-07 05:21:51
问题 This is a simple thing which I just couldn't figure out how to do. I converted a pre-trained VGG caffe model to tensorflow using the github code from https://github.com/ethereon/caffe-tensorflow and saved it to vgg16.npy... I then load the network to my sess default session as "net" using: images = tf.placeholder(tf.float32, [1, 224, 224, 3]) net = VGGNet_xavier({'data': images, 'label' : 1}) with tf.Session() as sess: net.load("vgg16.npy", sess) After net.load, I get a graph with a list of

Changing the scale of a tensor in tensorflow

為{幸葍}努か 提交于 2021-02-07 05:14:26
问题 Sorry if I messed up the title, I didn't know how to phrase this. Anyways, I have a tensor of a set of values, but I want to make sure that every element in the tensor has a range from 0 - 255, (or 0 - 1 works too). However, I don't want to make all the values add up to 1 or 255 like softmax, I just want to down scale the values. Is there any way to do this? Thanks! 回答1: You are trying to normalize the data. A classic normalization formula is this one: normalize_value = (value − min_value) /

Changing the scale of a tensor in tensorflow

允我心安 提交于 2021-02-07 05:05:49
问题 Sorry if I messed up the title, I didn't know how to phrase this. Anyways, I have a tensor of a set of values, but I want to make sure that every element in the tensor has a range from 0 - 255, (or 0 - 1 works too). However, I don't want to make all the values add up to 1 or 255 like softmax, I just want to down scale the values. Is there any way to do this? Thanks! 回答1: You are trying to normalize the data. A classic normalization formula is this one: normalize_value = (value − min_value) /

Add DropOut after loading the weights in Keras

余生长醉 提交于 2021-02-07 04:37:50
问题 I am doing king of transfer learning. What I have done is First train the model with the big datasets and save the weights. Then I train the model with my dataset by freezing the layers. But I see there was some overfitting. So I try to change the dropout of the model and load the weights since the numbers are changing while drop out are changing. I find difficulties to change the dropout. Directly my question is, Is it possible to change the model's dropout while loading the weights? my

How to save trained model in tensorflow?

喜欢而已 提交于 2021-02-07 03:51:33
问题 I wrote a convolutional neural network in tensorflow to perform on the mnist dataset. Everything works just fine, but i want to save the model with the tf.train.Saver(). How am i gonna do it? Here is my code: from __future__ import print_function import tensorflow as tf # Import MNIST data from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("/tmp/data/", one_hot=True) # Parameters learning_rate = 0.001 training_iters = 200000 batch_size = 128 display

How to save trained model in tensorflow?

谁都会走 提交于 2021-02-07 03:48:19
问题 I wrote a convolutional neural network in tensorflow to perform on the mnist dataset. Everything works just fine, but i want to save the model with the tf.train.Saver(). How am i gonna do it? Here is my code: from __future__ import print_function import tensorflow as tf # Import MNIST data from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("/tmp/data/", one_hot=True) # Parameters learning_rate = 0.001 training_iters = 200000 batch_size = 128 display

Training a simple model in Tensorflow GPU slower than CPU

二次信任 提交于 2021-02-07 02:39:35
问题 I have set up a simple linear regression problem in Tensorflow, and have created simple conda environments using Tensorflow CPU and GPU both in 1.13.1 (using CUDA 10.0 in the backend on an NVIDIA Quadro P600). However, it looks like the GPU environment always takes longer time than the CPU environment. The code I'm running is below. import time import warnings import numpy as np import scipy import tensorflow as tf import tensorflow_probability as tfp from tensorflow_probability import

How to add additional classes to a pre-trained object detection model and train it to detect all of the classes (pre-trained + new)?

一世执手 提交于 2021-02-07 00:59:45
问题 I had followed this blog --> https://medium.com/@teyou21/training-your-object-detection-model-on-tensorflow-part-2-e9e12714bdf , and built a SSD Mobilenet model which is pre-trained on the COCO Dataset called "ssd_mobilenet_v2_quantized_coco". What happens here is that it perfectly detects my new classes, but I want to include the pre-trained classes as well. I tried changing the number of classes to 96 ( 90 pre-trained + 6 new ) and edited the "labelmap.pbtxt" with the name and corresponding

How to add additional classes to a pre-trained object detection model and train it to detect all of the classes (pre-trained + new)?

白昼怎懂夜的黑 提交于 2021-02-07 00:58:35
问题 I had followed this blog --> https://medium.com/@teyou21/training-your-object-detection-model-on-tensorflow-part-2-e9e12714bdf , and built a SSD Mobilenet model which is pre-trained on the COCO Dataset called "ssd_mobilenet_v2_quantized_coco". What happens here is that it perfectly detects my new classes, but I want to include the pre-trained classes as well. I tried changing the number of classes to 96 ( 90 pre-trained + 6 new ) and edited the "labelmap.pbtxt" with the name and corresponding

小白学PyTorch | 15 TF2实现一个简单的服装分类任务

爷,独闯天下 提交于 2021-02-06 21:36:42
【机器学习炼丹术】的学习笔记分享 <<小白学PyTorch>> 小白学PyTorch | 14 tensorboardX可视化教程 小白学PyTorch | 13 EfficientNet详解及PyTorch实现 小白学PyTorch | 12 SENet详解及PyTorch实现 小白学PyTorch | 11 MobileNet详解及PyTorch实现 小白学PyTorch | 10 pytorch常见运算详解 小白学PyTorch | 9 tensor数据结构与存储结构 小白学PyTorch | 8 实战之MNIST小试牛刀 小白学PyTorch | 7 最新版本torchvision.transforms常用API翻译与讲解 小白学PyTorch | 6 模型的构建访问遍历存储(附代码) 小白学PyTorch | 5 torchvision预训练模型与数据集全览 小白学PyTorch | 4 构建模型三要素与权重初始化 小白学PyTorch | 3 浅谈Dataset和Dataloader 小白学PyTorch | 2 浅谈训练集验证集和测试集 小白学PyTorch | 1 搭建一个超简单的网络 小白学PyTorch | 动态图与静态图的浅显理解 这个系列《小白学PyTorch》的所有代码和数据集放在了公众号【机器学习炼丹术】后台,回复【pytorch】获取(已经更新到最新