tensorflow

SavedModel file does not exist when using Tensorflow hub

六眼飞鱼酱① 提交于 2021-01-28 19:35:41
问题 When trying to use the hub.load function from tensorflow_hub , I get an OSError: SavedModel file does not exist at: error. The weird thing is that it worked a few days ago, so I don't quite understand why I'm getting this error now. Code to reproduce: import tensorflow as tf import tensorflow_hub as hub URL = 'https://tfhub.dev/google/universal-sentence-encoder/4' embed = hub.load(URL) Specific error received: OSError Traceback (most recent call last) <ipython-input-11-dfb80f0299b2> in

Cannot convert tf.keras.layers.ConvLSTM2D layer to open vino intermediate representation

狂风中的少年 提交于 2021-01-28 19:06:17
问题 I am trying to convert a trained model in tensorflow to Open VINO Intermediate Representation. I have a model of the form given below class Conv3DModel(tf.keras.Model): def __init__(self): super(Conv3DModel, self).__init__() # Convolutions self.conv1 = tf.compat.v2.keras.layers.Conv3D(32, (3, 3, 3), activation='relu', name="conv1", data_format='channels_last') self.pool1 = tf.keras.layers.MaxPool3D(pool_size=(2, 2, 2), data_format='channels_last') self.conv2 = tf.compat.v2.keras.layers.Conv3D

OpenCV dnn exception SSD Mobilenetv2

╄→尐↘猪︶ㄣ 提交于 2021-01-28 19:05:54
问题 Using transfer learning, I trained SSD MobileNetV2 (ssd_mobilenet_v2_coco.config) model in TensorFlow (tensorflow-gpu==1.15.0). After freezing the graph (.pb) using TensorFlow API Python script (export_inference_graph.py), I created a text graph (.pbtxt) using the Python script provided in OpenCV wiki (tf_text_graph_ssd.py). I used the Python code snippet from the wiki to test inference, but I am getting the following error: cv2.error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules

Why is the per sample prediction time on Tensorflow (and Keras) lower when predicting on batches than on individual samples?

∥☆過路亽.° 提交于 2021-01-28 18:54:04
问题 I am using my trained model to make predictions (CPU only). I observe that both on Tensorflow and Keras with Tensorflow backend, the prediction time per sample is much lower when a batch of samples is used as compared to an individual sample. Moreover, the time per sample seems to go down with increasing batch size up to the limits imposed by memory. As an example, on pure Tensorflow, prediction of a single sample takes ~ 1.5 seconds , on 100 samples it is ~ 17 seconds (per sample time ~ 0

Can I import tensorflow and keras in Maya , Blender

▼魔方 西西 提交于 2021-01-28 18:52:06
问题 I am participating in a workshop , where we need to automatically rig characters . Perhaps , we will use deep learning methods . The task is to recognize body parts . My question : Is there a way for connecting tensorflow and keras , or other neural networks with 3D software? 回答1: For blender you can follow this tutorial, https://www.youtube.com/watch?v=J7Iu1rfwbds I tested it in Blender 2.81 and Python 3.7 by importing pytorch, opencv, sklearn etc. Also the test code provided in the video

“ValueError: Unknown layer: … ” when calling copy.deepcopy(network) using Tensorflow

|▌冷眼眸甩不掉的悲伤 提交于 2021-01-28 18:15:56
问题 I am currently designing a NoisyNet in Tensorflow, for which I need to define a custom layer. When copying a model containing that custom layer, python raises the error ValueError: Unknown layer: NoisyLayer . The implementation of the layer is provided here. The goal is to copy one network creating a second instance of it. For that purpose, I use the command net_copy = copy.deepcopy(net_original) , which works as long as I don't include the custom layer referred to above in the model to be

“ValueError: Unknown layer: … ” when calling copy.deepcopy(network) using Tensorflow

巧了我就是萌 提交于 2021-01-28 18:14:50
问题 I am currently designing a NoisyNet in Tensorflow, for which I need to define a custom layer. When copying a model containing that custom layer, python raises the error ValueError: Unknown layer: NoisyLayer . The implementation of the layer is provided here. The goal is to copy one network creating a second instance of it. For that purpose, I use the command net_copy = copy.deepcopy(net_original) , which works as long as I don't include the custom layer referred to above in the model to be

How can I know the output and input tensor names in a saved model

我的梦境 提交于 2021-01-28 13:52:53
问题 I know how to load a saved TensorFlow model but how will I know the input and output tensor names. I can load a protobuf file using tf.import_graph_def and then load the tensors using function get_tensor_by_name but how will I know the tensor names of any pre-trained model. Do I need to check their documentation or is there any other way. 回答1: Assuming that the input and output tensors are placeholders, something like this should be helpful for you: X = np.ones((1,3), dtype=np.float32) tf

Loading TF Records into Keras

旧时模样 提交于 2021-01-28 13:50:54
问题 I am trying to load a custom TFRecord file into my keras model. I attempted to follow this tutorial: https://medium.com/@moritzkrger/speeding-up-keras-with-tfrecord-datasets-5464f9836c36, but adapting for my use. My goal is to have the functions work similar to ImageDataGenerator from Keras. I cannot use that function because I specific metadata from the images that the generator does not grab. I'm not including that metadata here because I just need the basic network to function first. I

Only integer scalar arrays can be converted to a scalar index how to resolve

左心房为你撑大大i 提交于 2021-01-28 13:41:34
问题 File "C:/Users/Benji/PycharmProjects/Code/ANOTHER22.py", line 57, in generator x_class[np.array(y)[i]].append(np.array(x)[i]) TypeError: only integer scalar arrays can be converted to a scalar index x_class = [[] for i in range(len(np.unique(y)))] for i in range(len(x)): x_class[y[i]].append(x[i]) 来源: https://stackoverflow.com/questions/61717955/only-integer-scalar-arrays-can-be-converted-to-a-scalar-index-how-to-resolve