tensorflow

Tensorflow ValueError: Failed to find data adapter that can handle input

﹥>﹥吖頭↗ 提交于 2021-02-10 20:32:08
问题 Hello I'm trying to make the basic example of tensorflow minst using data from images on my pc. But I run into this error all the time: "ValueError: Failed to find data adapter that can handle input: , ( containing values of types {""})" here's how i generate data: import numpy as np # for array operations import matplotlib.pyplot as plt # to show image import os # to move through directories import cv2 # to make image operations import random import pickle DATADIR=r"C:\Users\...\mnist_png

Tensorflow to ONNX conversion

限于喜欢 提交于 2021-02-10 20:22:44
问题 I'm currently trying to convert a saved (and working) .pb file that I created with this tutorial (https://github.com/thtrieu/darkflow) into a onnx file. I'm using winML tools at the moment but the result of the conversion doesn't work at all (the input parameters are wrong + the whole architecture is not correct). My input parameter (as specified on the very bottom of the readme): input:0 Output node: ouput:0 I want to use the converted model inside a UWP application that's running on a

Tensorflow to ONNX conversion

懵懂的女人 提交于 2021-02-10 20:19:37
问题 I'm currently trying to convert a saved (and working) .pb file that I created with this tutorial (https://github.com/thtrieu/darkflow) into a onnx file. I'm using winML tools at the moment but the result of the conversion doesn't work at all (the input parameters are wrong + the whole architecture is not correct). My input parameter (as specified on the very bottom of the readme): input:0 Output node: ouput:0 I want to use the converted model inside a UWP application that's running on a

Using ops from Tensorflow.contrb on Windows via Java API

南楼画角 提交于 2021-02-10 20:12:56
问题 I would like to load an op from tf.contrib , specifically "_beam_search_ops". I use Tensorflow 1.6 from Maven. Following the answer at Issue while loading/serving tensorflow model in java using estimators , I'm able to do so on Ubuntu 17.10. The code looks like so: TensorFlow.loadLibrary("_beam_search_ops.so"); Then I try to do the same in Windows 10 with code TensorFlow.loadLibrary("_beam_search_ops.dll"); And it fails with java.lang.UnsatisfiedLinkError: D:\Users\ALEXAN~1\AppData\Local\Temp

Using ops from Tensorflow.contrb on Windows via Java API

杀马特。学长 韩版系。学妹 提交于 2021-02-10 20:11:10
问题 I would like to load an op from tf.contrib , specifically "_beam_search_ops". I use Tensorflow 1.6 from Maven. Following the answer at Issue while loading/serving tensorflow model in java using estimators , I'm able to do so on Ubuntu 17.10. The code looks like so: TensorFlow.loadLibrary("_beam_search_ops.so"); Then I try to do the same in Windows 10 with code TensorFlow.loadLibrary("_beam_search_ops.dll"); And it fails with java.lang.UnsatisfiedLinkError: D:\Users\ALEXAN~1\AppData\Local\Temp

Using prediction from keras model as a layer inside another keras model

半世苍凉 提交于 2021-02-10 18:25:05
问题 Suppose we have a model already trained for some task can we use that models prediction as a lambda layer inside another model? I am thinking something in the following format: pretrained_model=get_Model() #Loaded from a different file pretrained_model.load_weights('pretrained_model_weights.h5') base_model = VGG16(weights = 'imagenet',include_top=False,input_shape (240,320,3)) for layer in base_model.layers: layer.trainable = True img_input=base_model.input encoded=base_model.output

Output dimension of Keras model

岁酱吖の 提交于 2021-02-10 18:07:14
问题 I use ImageDataGenerator to load my training data train_generator = train_datagen.flow_from_directory( directory= TRAIN_PATH, target_size=(224, 224), color_mode="rgb", batch_size=32, class_mode="categorical", shuffle=True, seed=42 ) After that I get a message Found 6552 images belonging to 102 classes. When I define the model the way model1 = MobileNetV2(include_top=False, input_shape=(224, 224, 3)) flat1 = Flatten()(model1.outputs) class1 = Dense(1024, activation='relu')(flat1) output =

Why Tensorflow creates so many CPU threads

爱⌒轻易说出口 提交于 2021-02-10 18:06:42
问题 Even with inter_op_parallelism_threads = 1 intra_op_parallelism_threads = 1 values set, TensorFlow 1.5 process is not single-threaded. Why? Is there a way to completely disable unexpected thread spawning? 回答1: First of all, TensorFlow is a multi-level software stack, and each layer tries to be smart and introduces some worker threads of its own: One thread is created by Python runtime Two more threads are created by NVIDIA CUDA runtime Next, there are threads originating from the way how

Setting values of a tensor at the indices given by tf.where()

陌路散爱 提交于 2021-02-10 17:57:24
问题 I am attempting to add noise to a tensor that holds the greyscale pixel values of an image. I want to set a random number of the pixels values to 255. I was thinking something along the lines of: random = tf.random_normal(tf.shape(input)) mask = tf.where(tf.greater(random, 1)) and am then trying to figure out how to set the pixel values of input to 255 for every index of mask . 回答1: tf.where() can be used for this too, assigning the noise value where mask elements are True , else the original

Merge rows together who have the same value in a column

大兔子大兔子 提交于 2021-02-10 17:44:30
问题 I have a CSV file like this (which parsed by using the pandas by using read_csv): Filename f1 f2 f3 1.jpg 1 0.2 0.3 1.jpg 0 0.8 0.7 2.jpg 1 0.3 0.2 How would I use this dataset and change it into a numpy array which will look like this: [ [[1,0.2,0.3],[0,0.8.0.7]], [[1,0.3,0.2]] ] 回答1: You can create nested lists by GroupBy.apply with lambda function, DataFrame.set_index is for avoid convert column Filename to lists: df = pd.read_csv(file) L = (df.set_index('Filename') .groupby('Filename')