tensorflow

Keras dimension mismatch with ImageDataGenerator

折月煮酒 提交于 2021-01-28 07:13:41
问题 I am attempting to 'flow' my data into a neural network with Keras. I am using the .flow_from_directory method and the process is giving me fits. I am using the basic example from the keras documentation (I am using tensorflow): ROWS = 64 COLS = 64 CHANNELS = 3 from keras.preprocessing.image import ImageDataGenerator train_datagen = ImageDataGenerator( rescale=1./255) test_datagen = ImageDataGenerator(rescale=1./255) train_generator = train_datagen.flow_from_directory( 'train', target_size=

Keras: How to save models or weights?

╄→гoц情女王★ 提交于 2021-01-28 07:02:41
问题 I am sorry if this question seems pretty straight forward. But reading the Keras save and restore help page : https://www.tensorflow.org/beta/tutorials/keras/save_and_restore_models I do not understand how to use the "ModelCheckpoint" for saving during training. The help file mentions it should give 3 files, I see only one, MODEL.ckpt. Here is my code: checkpoint_dir = FolderName + "/tmp/model.ckpt" cp_callback = k.callbacks.ModelCheckpoint(checkpoint_dir,verbose=1,save_weights_only=True)

Tensorflow, uninitialized variables despite running global_variable_initializer

﹥>﹥吖頭↗ 提交于 2021-01-28 06:50:21
问题 I'm new to Tensorflow. I worked in Caffe previously. I'm trying to implement http://cvlab.cse.msu.edu/pdfs/Tai_Yang_Liu_CVPR2017.pdf in Tensorflow. I'm having trouble with variables in Tensorflow, despite having them initialized. I tried using tf.get_variable instead of tf.Variable, but this didn't work. And setting initializer=tf.contrib.layers.xavier_initializer() did nothing. My code: import tensorflow as tf import sys, os import numpy as np global xseed def get_model(inp, train): #create

Error installing Tensorflow in docker image

橙三吉。 提交于 2021-01-28 06:41:39
问题 I am trying to install tensorflow in docker image for my application. I have 3 files in the folder which i am using to build image. Dockerfile , index.py and requirements.txt Contents of these files are Dockerfile FROM python:alpine3.7 COPY . /app WORKDIR /app RUN pip3 install -r requirements.txt EXPOSE 5000 CMD python ./index.py requirements.txt tensorflow==1.1.0 scikit-learn==0.18.2 scipy==0.19.1 numpy==1.13.1 requests==2.18.3 index.py from flask import Flask app = Flask(__name__) @app

Generating data for training in keras

做~自己de王妃 提交于 2021-01-28 06:39:56
问题 My training set is really quite large. The entire thing takes up about 120GB of RAM and so I can't even generate the numpy.zeros() array to store the data. From what I've seen, using a generator works well when the entire dataset is already loaded into an array but then is incrementally fed into the network and then deleted afterwards. Is it alright for the generator to create the arrays, insert the data, load the data into the network, delete the data? Or will that whole process take too

Using Instance Keys for Batch Prediction w/Tensorflow

*爱你&永不变心* 提交于 2021-01-28 06:08:31
问题 I am trying to figure out how to do batch prediction using Google Cloud. Specifically, I'm looking to do object detection, getting from a faster-RCNN tensorflow ckpt to a graph/saved model. My issue is that I need to be able to recover some kind of ID for my input images, perhaps an index or a filename. I'm not entirely sure how to do this in my situation, since this link mentions using instance keys, and the only relevant examples I've found regarding instance keys use JSON as the input

Question About Dropout Layer and Batch Normalization Layer in DNN model

痴心易碎 提交于 2021-01-28 06:04:02
问题 I have some queries about the Dropout layer and Batch normalized layer. Basically, I have made a simple DNN structure with a Dropout layer and Batch normalized layer and train it that's fine. The simple structure of DNN model for example: from tensorflow import keras from tensorflow.keras import layers model = keras.Sequential([ layers.Dense(10, activation='relu', input_shape=[11]), layers.Dropout(0.3), layers.BatchNormalization(), layers.Dense(8, activation='relu'), layers.Dropout(0.3),

Question About Dropout Layer and Batch Normalization Layer in DNN model

廉价感情. 提交于 2021-01-28 06:00:24
问题 I have some queries about the Dropout layer and Batch normalized layer. Basically, I have made a simple DNN structure with a Dropout layer and Batch normalized layer and train it that's fine. The simple structure of DNN model for example: from tensorflow import keras from tensorflow.keras import layers model = keras.Sequential([ layers.Dense(10, activation='relu', input_shape=[11]), layers.Dropout(0.3), layers.BatchNormalization(), layers.Dense(8, activation='relu'), layers.Dropout(0.3),

Converting model to tflite with SELECT_TF_OPS cannot convert ops HashTableV2 + others

孤者浪人 提交于 2021-01-28 05:40:31
问题 I'm trying to convert openimages_v4/ssd/mobilenet_v2 to tflite using the following code as suggested here: import tensorflow as tf MODEL_DIR = 'openimages_v4_ssd_mobilenet_v2_1' SIGNATURE_KEYS = ['default'] SIGNATURE_TAGS = set() saved_model = tf.saved_model.load(MODEL_DIR, tags=SIGNATURE_TAGS) tf.saved_model.save(saved_model, 'new_model_path', signatures=saved_model.signatures) converter = tf.lite.TFLiteConverter.from_saved_model('new_model_path', signature_keys=SIGNATURE_KEYS, tags=['serve'

Tensorflow lite model request a buffer bigger than the neccesary

和自甴很熟 提交于 2021-01-28 05:22:19
问题 I created a custom model using keras in tensorflow. The version that I used was tensorflow nightly 1.13.1. I used the official tool to build the tensorflow lite model (the method tf.lite.TFLiteConverter.from_keras_model_file ). After I created the model I reviewed the input shape and nothing seems is bad. The input and output shapes in tensorflow lite model are: [{'name': 'input_1', 'index': 59, 'shape': array([ 1, 240, 240, 3], dtype=int32), 'dtype': , 'quantization': (0.0, 0)}] [{'name':