Categories
Misc

Image classification FCN training

I have a dataset of posts on a website (which I have downloaded in file format data/category1 and data/category2) all are png, or jpg format files. All with unique dimensions. Is there a way to train the neural network without resizing the images? I already know I would have to train them in separate batches, but I cannot for the life of me figure out how to get them all into individual batches to be trained. Thank you in advance for your help 😀

submitted by /u/Yo1up
[visit reddit] [comments]

Categories
Misc

Error when returning tf.keras.Model

I want to create a python program for neural style transfer based on this tutorial: https://medium.com/tensorflow/neural-style-transfer-creating-art-with-deep-learning-using-tf-keras-and-eager-execution-7d541ac31398. They used tensorflow 1.* for this but I use tensorflow 2.* (gpu), so I had to change a few things. Both my version and the original version of the program raised a ValueError when I tried to return a vgg19 model. Can someone explain this error or tell me how to fix it?

“`def get_model(): vgg = tf.keras.applications.vgg19.VGG19(include_top = False, weights = ‘imagenet’) vgg.trainable = False style_outputs = [vgg.get_layer(name) for name in style_layers] content_outputs = [vgg.get_layer(name) for name in content_layers] model_outputs = style_outputs + content_outputs return tf.keras.Model(vgg.input, model_outputs)

Traceback (most recent call last): File “NSTV2.py”, line 155, in <module> main() File “NST_V2.py”, line 152, in main best, best_loss = run_style_transfer(args[‘content’], args[‘style’]) File “NST_V2.py”, line 101, in run_style_transfer model = get_model() File “NST_V2.py”, line 48, in get_model return tf.keras.Model(vgg.input, model_outputs) File “C:UsersfreddAppDataLocalProgramsPythonPython38libsite-packagestensorflowpythontrainingtrackingbase.py”, line 517, in _method_wrapper result = method(self, args, *kwargs) File “C:UsersfreddAppDataLocalProgramsPythonPython38libsite-packagestensorflowpythonkerasenginefunctional.py”, line 120, in __init_ self._init_graph_network(inputs, outputs) File “C:UsersfreddAppDataLocalProgramsPythonPython38libsite-packagestensorflowpythontrainingtrackingbase.py”, line 517, in _method_wrapper result = method(self, args, *kwargs) File “C:UsersfreddAppDataLocalProgramsPythonPython38libsite-packagestensorflowpythonkerasenginefunctional.py”, line 157, in _init_graph_network self._validate_graph_inputs_and_outputs() File “C:UsersfreddAppDataLocalProgramsPythonPython38libsite-packagestensorflowpythonkerasenginefunctional.py”, line 727, in _validate_graph_inputs_and_outputs raise ValueError(‘Output tensors of a ‘ + cls_name + ‘ model must be ‘ ValueError: Output tensors of a Functional model must be the output of a TensorFlow Layer (thus holding past layer metadata). Found: <tensorflow.python.keras.layers.convolutional.Conv2D object at 0x000002A05C2F9D60>“`

submitted by /u/Jirne_VR
[visit reddit] [comments]

Categories
Misc

Tensorflow DQN execution time keeps on increasing

Hello. I have a question regarding tensorflow. I was working on a Deep Q Network problem using Tensorflow. The code is as follows:

“`

g = tf.Graph() with g.as_default(): w_1 = tf.Variable(tf.truncated_normal([n_input, n_hidden_1], stddev=0.1)) w_1_p = tf.Variable(tf.truncated_normal([n_input, n_hidden_1], stddev=0.1)) ## There are other parameters too but they are excluded for simplicity

def update_target_q_network(sess): “”” Update target q network once in a while “”” sess.run(w_1_p.assign(sess.run(w_1)))

for i_episode in range(n_episode): …….. #Code removed for simplicity if i_episode%10 == 0: update_target_q_network(centralsess) ……..

“`

Basically after every specific number of n_episodes (10 in this case), the parameter w_1 is copied to w_1_p.

The issue with the code is that the time it takes to run the function update_target_q_network keeps on increasing as the n_episodes increase. So for example it takes 0-1 second for 100th episode however the time increase to 220 seconds for 7500th episode. Can anyone kindly tell how can the running time of the code can be improved? I tried reading the reason (the graph keeps on becoming larger) but I am not sure about that or how or change code to reduce time. Thank you for your help.

submitted by /u/FarzanUllah
[visit reddit] [comments]

Categories
Misc

Pre-Processing Images for Pre-Trained Models in Tensorflow.js

Check out my question on stackoverflow for specifics, but I’m wondering about general strategies for pre-processing inputs into Tensorflow.js….do I need to use a convolutional network? Can I use the model to pre-process input? There’s some commands in python that are missing in js for doing this

submitted by /u/areddy831
[visit reddit] [comments]

Categories
Misc

Unable to print tf.Variable objects

I am trying to print a list of objects, some of which are constants and some and some are variables. When i print the list, only the constant tensors are shown, while Variables are are represented by empty space. They are present in the calculation, and that is going through without a hitch. But somehow in this print issue, they are absent.

submitted by /u/curtlytalks
[visit reddit] [comments]

Categories
Misc

Big Planet, Bigger Data: How UK Research Center Advances Environmental Science with AI

Climate change is a big problem, and big problems require big data to understand. Few research centers take a wider lens to environmental science than the NERC Earth Observation Data Acquisition and Analysis Service (NEODAAS). Since the 1990s, the service, part of the United Kingdom’s Natural Environment Research Council and overseen by the National Centre Read article >

The post Big Planet, Bigger Data: How UK Research Center Advances Environmental Science with AI appeared first on The Official NVIDIA Blog.