tensorflow

Is there any way to access layers in tensorflow_hub.KerasLayer object?

依然范特西╮ 提交于 2021-01-28 03:21:13
问题 I am trying to use a pre-trained model from tensorflow hub into my object detection model. I wrapped a model from hub as a KerasLayer object following the official instruction. Then I realized that I cannot access the layers in this pre-trained model . But I need to use outputs from some specific layers to build my model. Is there any way to access layers in tensorflow_hub.KerasLayer object? 回答1: For one to be able to do that easily, the creator of the pretrained model would have needed to

ValueError: Error when checking target: expected dense_1 to have 2 dimensions, but got array with shape (68, 50, 50, 50, 1)

坚强是说给别人听的谎言 提交于 2021-01-28 03:12:05
问题 I'm trying to build a convolutional network that will work on a 3D voxel grid. I try to add a fully connected layer but get an error: ValueError: Error when checking target: expected dense_1 to have 2 dimensions, but got array with shape (68, 50, 50, 50, 1) How can this be happening when I have a flatten layer first? Shouldn't my input to the dense layer at that point be, well, flat? x, y = load_data(directory) x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.25, random

How to load EMNIST data to Tensorflow

我怕爱的太早我们不能终老 提交于 2021-01-28 02:40:22
问题 In all the tutorials i've seen for tensorflow, they've used the MNIST dataset, i've understood the modelling but how do i load this dataset into tensorflow? https://www.nist.gov/itl/iad/image-group/emnist-dataset 回答1: The EMNIST dataset uses the same binary format as the original MNIST dataset. Therefore you can take the input pipeline code from any tutorial that uses the original MNIST dataset, and point it at the set of files you get from downloading the EMNIST dataset to train on that

SyntaxError: future feature google_type_annotations is not defined [closed]

半城伤御伤魂 提交于 2021-01-28 02:03:24
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 1 year ago . Improve this question from __future__ import google_type_annotations I installed python 3.7 as it was suggested in this solution. I get the following error when I run the file. Traceback (most recent call last): File "run_classifier_with_tfhub.py", line 21, in <module> import classifier_utils File "

No module named 'tensorflow.contrib' while importing tflearn

折月煮酒 提交于 2021-01-28 01:18:12
问题 While I was importing tflearn I'm getting this error:- import tflearn Traceback (most recent call last): File "", line 1, in File "/Users/rohansethi/anaconda3/lib/python3.7/site-packages/tflearn/ init .py", line 4, in from . import config File "/Users/rohansethi/anaconda3/lib/python3.7/site-packages/tflearn/config.py", line 5, in from .variables import variable File "/Users/rohansethi/anaconda3/lib/python3.7/site-packages/tflearn/variables.py", line 7, in from tensorflow.contrib.framework

How to fix Illegal instruction (core dumped)

主宰稳场 提交于 2021-01-28 00:51:32
问题 Hi i am trying to fix this issue when i run python3 brain.py below i get this error Illegal instruction (core dumped) from imageai.Prediction import ImagePrediction import os execution_path=os.getcwd() prediction = ImagePrediction() prediction.setModelTypeAsSqueezeNet() prediction.setModelPath(os.path.join(execution_path, "squeezenet_weights_tf_dim_ordering_tf_kernels.h5")) prediction.loadModel() predictions, probabilities = prediction.predictImage(os.path.join(execution_path, "giraffe.jpg"),

How to convert a dictionary into a tensor in tensorflow

泄露秘密 提交于 2021-01-28 00:50:40
问题 This is the dictionary I have: docs = {'computer': {'1': 1, '3': 5, '8': 2}, 'politics': {'0': 2, '1': 2, '3': 1}} I want to create a 9 * 2 tensor like this: [ [0, 1, 0, 5, 0, 0, 0, 0, 2], [2, 2, 0, 1, 0, 0, 0, 0, 0, 0] ] Here, because the max item is 8 so we have 9 rows. But, the number of rows and columns can increase based on the dictionary. I have tried to implement this using for-loop though as the dictionary is big it's not efficient at all and also it implemented using the list I need

Tensorflow 2 Hub: How can I obtain the output of an intermediate layer?

橙三吉。 提交于 2021-01-27 23:54:54
问题 I am trying to implement following network Fots for Text detection using the new tensorflow 2. The authors use the resnet as the backbone of their network, so my first thought was to use the tensoflow hub resnet for loading a pretrained network. But the problem is that i can not find a way to print the summary of the module, which is loaded from tfhub? Is there any way to see the layers of the loaded modules from tf-hub? Thanks Update Unfortunately is the resnet not available for tf2-hub, so

Why the first convolutional layer weights don't change during training?

a 夏天 提交于 2021-01-27 23:11:02
问题 I got the tensorflow mnist treaining example from here https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/3_NeuralNetworks/convolutional_network.py and addd the first convolutional layer visualization code I got from here: https://gist.github.com/kukuruza/03731dc494603ceab0c5 (I modified the code slightly to adapt it for grayscale images) The thing I see is that the image does not change at all during the training! However, if I initialize the first layer with zeroes

how to change the image dimensions to get my convolution algorithm working

孤者浪人 提交于 2021-01-27 23:03:31
问题 Basically pygame.surfarray.pixels3d returns a (672,672,3) shaped array which gives the error: Resources exhausted but it works when I pass an array of (6,30,30) . Any help would be appreciated. import numpy import random from DeepRTS import PyDeepRTS from Algorithms.DQN2.DQN import DQN # Start the game g = PyDeepRTS('21x21-2v2.json') # Add players player1 = g.add_player() player2 = g.add_player() #player3 = g.add_player() #player4 = g.add_player() # Set FPS and UPS limits g.set_max_fps