tensorflow

How To Get The Pixel Count Of A Segmented Area in an Image I used Vgg16 for Segmentation

人盡茶涼 提交于 2021-01-29 06:44:59
问题 I am new to deep learning but have succeeded in semantic segmentation of the image I am trying to get the pixel count of each class in the label. As an example in the image I want to get the pixel count of the carpet, or the chandelier or the light stand. How do I go about? Thanks any suggestions will help. 回答1: Edit: In what format the regions are returned? Do you have only the final image or the regions are given as contours? If you have them as contours (list of coordinates), you can apply

Converting pretrained model from tfhub to tflite

你。 提交于 2021-01-29 06:26:53
问题 I'm trying to convert openimages_v4/ssd/mobilenet_v2 to tflite using: $ pip3 install tensorflow==2.4.0 $ tflite_convert --saved_model_dir=openimages_v4_ssd_mobilenet_v2_1 --output_file=/tmp/openimages_v4_ssd_mobilenet_v2_1.tflite but it's giving this error: <stacktrace snipped ..> RuntimeError: MetaGraphDef associated with tags {'serve'} could not be found in SavedModel. To inspect available tag-sets in the SavedModel, please use the SavedModel CLI: `saved_model_cli` available_tags: [set()]

How to create sum of different kernel objects in TensorFlow Probability?

给你一囗甜甜゛ 提交于 2021-01-29 06:18:13
问题 I have one question about specifying kernel function in Tensorflow-probability . Usually, if I want to create a kernel object, I will write import tensorflow as tf import tensorflow_probability as tfp tfp_kernels = tfp.positive_semidefinite_kernels kernel_obj = tfp_kernels.ExponentiateQuadratic(*args, **karwgs) I know that kernel object support batch broadcasting. But what if I want to build a kernel object that is the sum of several different kernel objects, like additive Gaussian processes?

Fitting array to datagen then passing as parameter to Keras Classifier

孤人 提交于 2021-01-29 06:11:04
问题 I have a convolutional neural network that i am using to classify cats and dogs, using keras classifier. I had to use custom cross validation, due to how my data is organized, where i have n groups of different breeds of cats and dogs and each breed has 200 images, 600 images per pet class. Now, what i am trying to do is create augmented data (on the fly/in place data augmentation) and concatenate them to my original array of groups. However i get the following error when i try to iterate

Which strategy is for between-graph replication?

五迷三道 提交于 2021-01-29 06:07:26
问题 I was watching this video: Inside TensorFlow: tf.distribute.Strategy and understand that the tf.distribute.Strategy was designed in a way that it supports both in-graph replication and between-graph replication . (I'm collecting an overview of all the terminology and concepts here. Maybe I am just confusing things.) From all the code examples and existing strategy implementations (here or here), it looks like this is always using in-graph replication ? (Or is it actually always using between

tf.keras.predict() is much slower than Keras predict()

橙三吉。 提交于 2021-01-29 06:03:24
问题 When using the Keras that comes embedded with Tensorflow (Tensorflow 2), I noticed a severe increase in computational time when using the predict() function from the Keras embedded inside Tensorflow and the predict() from standalone Keras. See the toy code below: import tensorflow import keras import numpy as np import time test = np.array([[0.1, 0.1, 0.1, 0.1, 0.1, 0.5, 0.1, 0., 0.1, 0.2]]) # Keras from inside Tensorflow model_1 = tensorflow.keras.Sequential([ tensorflow.keras.layers.Dense(1

Error defining an input shape in keras for (60000, 28, 28) array

大憨熊 提交于 2021-01-29 05:57:06
问题 I am setting up my first neural network with keras and tensorflow. I got my input into an array of shape (60000, 28, 28), but when I try and feed it to the model I get an error that the input shape is wrong. I have tried multiple different input shapes including (60000, 28, 28) (1, 28, 28) (28, 28) (28, 28, 1) but none of them seem to work. model = kr.Sequential() model.add(InputLayer(input_shape=(60000, 28, 28))) model.add(Dense(units=784, activation='relu')) model.add(Dense(units=392,

Tf 2: Could not create cudnn handle: CUDNN_STATUS_INTERNAL_ERROR

落爺英雄遲暮 提交于 2021-01-29 05:54:29
问题 I am getting the above error (Could not create cudnn handle: CUDNN_STATUS_INTERNAL_ERROR) when I execute the code below. I have cheked if my gpu is woking using tf.test.is_gpu_available # coding: utf-8 import tensorflow as tf import numpy as np import keras from models import * import os import gc TF_FORCE_GPU_ALLOW_GROWTH = True np.random.seed(1000) #Paths MODEL_CONF = "../models/conf/" MODEL_WEIGHTS = "../models/weights/" #Model informations N_CLASSES = 3 def load_array(name): return np

How to extract cell state of LSTM model through model.fit()?

徘徊边缘 提交于 2021-01-29 05:47:37
问题 My LSTM model is like this, and I would like to get state_c def _get_model(input_shape, latent_dim, num_classes): inputs = Input(shape=input_shape) lstm_lyr,state_h,state_c = LSTM(latent_dim,dropout=0.1,return_state = True)(inputs) fc_lyr = Dense(num_classes)(lstm_lyr) soft_lyr = Activation('relu')(fc_lyr) model = Model(inputs, [soft_lyr,state_c]) model.compile(optimizer='adam', loss='mse', metrics=['accuracy']) return model model =_get_model((n_steps_in, n_features),latent_dim ,n_steps_out)

Why Keras Lambda-Layer cause problem Mask_RCNN?

▼魔方 西西 提交于 2021-01-29 05:28:04
问题 I'm using the Mask_RCNN package from this repo: https://github.com/matterport/Mask_RCNN . I tried to train my own dataset using this package but it gives me an error at the beginning. 2020-11-30 12:13:16.577252: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcuda.so.1 2020-11-30 12:13:16.587017: E tensorflow/stream_executor/cuda/cuda_driver.cc:314] failed call to cuInit: CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected 2020-11-30