tensorflow

Resizing images with dynamic shape in tensorflow

て烟熏妆下的殇ゞ 提交于 2021-02-10 14:38:28
问题 I want to resize 3D images with a dynamic shape, for instance go from shape (64,64,64,1) to (128,128,128,1). The idea is to unstack the image along one axis, then use tf.image.resize_images and stack them again. My issue is that tf.unstack can not handle variable sized inputs. If I run my code I obtain "ValueError: Cannot infer num from shape (?, ?, ?, 1)" I have considered using tf.split instead, however it expects an integer input. Does anybody know a workaround? Here is an example: import

I'm struggling to implement tensorboard monitoring into the Mask_RCNN training process

你。 提交于 2021-02-10 14:33:42
问题 I've been using the balloon.py example script in the Matterport Mask R-CNN repo [https://github.com/matterport/Mask_RCNN/blob/master/samples/balloon/balloon.py] for learning how to implement tensorboard to monitor the training process. The training itself is going fine, but I've completely failed to implement tensorboard. So far I've added: # create Tensorboard logdir = os.path.join("logs", datetime.datetime.now().strftime("%Y%m%d-%H%M%S")) tensorboard_callback = tf.keras.callbacks

Dataset shape mismatch Conv1D input layer

心不动则不痛 提交于 2021-02-10 14:33:28
问题 Trying to set up a Conv1D layer to be the input layer in keras. The dataset is 1000 timesteps, and each timestep has 1 feature. After reading a bunch of answers I reshaped my dataset to be in the following format of (n_samples, timesteps, features), which corresponds to the following in my case: train_data = (78968, 1000, 1) test_data = (19742, 1000, 1) train_target = (78968,) test_target = (19742,) I later create and compile the code using the following lines model = Sequential() model.add

CNN loss with multiple outputs?

寵の児 提交于 2021-02-10 14:33:08
问题 I have the following model def get_model(): epochs = 100 learning_rate = 0.1 decay_rate = learning_rate / epochs inp = keras.Input(shape=(64, 101, 1), name="inputs") x = layers.Conv2D(128, kernel_size=(3, 3), strides=(3, 3), padding="same")(inp) x = layers.Conv2D(256, kernel_size=(3, 3), strides=(3, 3), padding="same")(x) x = layers.Flatten()(x) x = layers.Dense(150)(x) x = layers.Dense(150)(x) out1 = layers.Dense(40000, name="sf_vec")(x) out2 = layers.Dense(128, name="ls_weights")(x) model =

Error converting Pegasus to the ONNX format from Transformers

◇◆丶佛笑我妖孽 提交于 2021-02-10 14:21:55
问题 I am trying to convert the Pegasus newsroom in HuggingFace's transformers model to the ONNX format. I followed this guide published by Huggingface. After installing the prereqs, I ran this code: !rm -rf onnx/ from pathlib import Path from transformers.convert_graph_to_onnx import convert convert(framework="pt", model="google/pegasus-newsroom", output=Path("onnx/google/pegasus-newsroom.onnx"), opset=11) and got these errors: ValueError Traceback (most recent call last) <ipython-input-9

Unable to load .h5 file made in Google Colab to Jupyter Notebook [duplicate]

∥☆過路亽.° 提交于 2021-02-10 14:16:25
问题 This question already has answers here : Unexpected keyword argument 'ragged' in Keras (2 answers) Closed last month . I tried a code for Face mask detect and alert system and I am getting an error regarding the same. I trained the model in Google Collaboratory and ran the following code in Jupyter Notebook. The code is as follows: # Import necessary libraries from keras.models import load_model import cv2 import numpy as np import tkinter from tkinter import messagebox import smtplib #

Where to find tensorflow pretrained models (list or download link)

时光怂恿深爱的人放手 提交于 2021-02-10 13:26:08
问题 I am starting to work with Intel movidius neural compute stick. To start working, in my case, it is necessary to download pretrained models. In the tutorials they refer to http://download.tensorflow.org/models/. However, there is not a list that shows all the models available for download. If the latest version of a net, lets say inception_v4, is not known, I cannot download the corresponding .tar.gz file. Does anyone know a method to have an updated list of the .tar.gz files of the

What's the difference between attrubutes 'trainable' and 'training' in BatchNormalization layer in Keras Tensorfolow?

回眸只為那壹抹淺笑 提交于 2021-02-10 12:52:46
问题 According to the official documents from tensorflow: About setting layer.trainable = False on a `BatchNormalization layer: The meaning of setting layer.trainable = False is to freeze the layer, i.e. its internal state will not change during training: its trainable weights will not be updated during fit() or train_on_batch(), and its state updates will not be run. Usually, this does not necessarily mean that the layer is run in inference mode (which is normally controlled by the training

Tensorflow-IO Dataset input pipeline with very large HDF5 files

孤街醉人 提交于 2021-02-10 12:19:31
问题 I have very big training (30Gb) files. Since all the data does not fit in my available RAM, I want to read the data by batch. I saw that there is Tensorflow-io package which implemented a way to read HDF5 into Tensorflow this way thanks to the function tfio.IODataset.from_hdf5() Then, since tf.keras.model.fit() takes a tf.data.Dataset as input containing both samples and targets, I need to zip my X and Y together and then use .batch and .prefetch to load in memory just the necessary data. For

Tensorflow-IO Dataset input pipeline with very large HDF5 files

亡梦爱人 提交于 2021-02-10 12:18:26
问题 I have very big training (30Gb) files. Since all the data does not fit in my available RAM, I want to read the data by batch. I saw that there is Tensorflow-io package which implemented a way to read HDF5 into Tensorflow this way thanks to the function tfio.IODataset.from_hdf5() Then, since tf.keras.model.fit() takes a tf.data.Dataset as input containing both samples and targets, I need to zip my X and Y together and then use .batch and .prefetch to load in memory just the necessary data. For