Categories
Misc

Problem with training VAE

Hello.

I’m new in to tensorflow. Been trying recreate VAE from tutorial ( author does not respond for questions) but i keeps getting error while training network :

ERROR:

Traceback (most recent call last): File "...train.py", line 45, in <module> autoencoder = train(x_train, LEARNING_RATE, BATCH_SIZE, EPOCHS) #here is problem File "...train.py", line 36, in train autoencoder.compile(learning_rate) File "...autoencoder.py", line 61, in compile self.model.compile(optimizer=optimizer, File "...libsite-packagestensorflowpythontrainingtrackingbase.py", line 530, in _method_wrapper result = method(self, *args, **kwargs) File "...libsite-packagestensorflowpythonkerasenginetraining_v1.py", line 444, in compile self._cache_output_metric_attributes(metrics, weighted_metrics) File "...libsite-packagestensorflowpythonkerasenginetraining_v1.py", line 1800, in _cache_output_metric_attributes self._per_output_metrics = training_utils_v1.collect_per_output_metric_info( File "...libsite-packagestensorflowpythonkerasenginetraining_utils_v1.py", line 910, in collect_per_output_metric_info metric_fn._from_serialized = from_serialized # pylint: disable=protected-access AttributeError: 'method' object has no attribute '_from_serialized' 

LINE 41-48 in train.py ( first two errors):

if __name__ == "__main__": x_train = load_fsdd(SPECTROGRAMS_PATH) autoencoder = train(x_train,LEARNING_RATE,BATCH_SIZE, EPOCHS) autoencoder.save("modelv1.0") 

LINE 59-64 in autoencoder.py:

def compile(self, learning_rate=0.0001): optimizer = Adam(learning_rate=learning_rate) self.model.compile(optimizer=optimizer, loss=self._calculate_combined_loss, metrics=[self._calculate_reconstruction_loss, self._calculate_kl_loss]) 

I’m using PyCharm CE 2021.1.1 and tensorflow 2.3.1

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

Categories
Misc

Mask RCNN dataset annotation tool

I am using labelImg to annotate custom datasets for Faster RCNN. What tools do you use to annotate images for Mask RCNN – create the masks?

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

Categories
Misc

Training and testing the embeddings in transfer learning

I am doing transfer learning with google audioset embeddings. The audioset corpus consists of pre-trained embeddings that are pre-activation (the final layers are removed).

While studying transfer learning, I have noticed that the checkpoint weights are used and the layers that produced these weights are frozen while the a model is built on top of the previous model.

Should I use the pre-trained weights of Audioset while using the embeddings of audioset itself for training the new model? It does not sound right as these embeddings are the bi product of these weights already. Please correct me if I am wrong.

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

Categories
Misc

Is it possible to start TensorFlow from an intermediate layer?

Hello,

I was wondering

Lets say if I get the output of an intermediary layer, would it be possible to feed the data back into the intermediary layer and resume the processing only from that layer?

Just wondering…..

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

Categories
Misc

Can any one tell me what are initial value of self.w made by Add_weight() function (when i=0) , i think they are zeros , note that units = 200 and input_dim = 128

Can any one tell me what are initial value of self.w made by Add_weight() function (when i=0) , i think they are zeros , note that units = 200 and input_dim = 128 submitted by /u/hichemito
[visit reddit] [comments]
Categories
Misc

Configuring Pipeline for MSCoco

I have been training a model using MS Coco 2017 dataset.

The Coco dataset is divided between train, test and validation. The key difference is the test dataset does not have bounding box annotations.

I didn’t realise this and I set the eval_input _reader to point at the Coco test dataset .tfrecord files.

Is this incorrect? Should I instead point it towards the validation dataset which has the bounding-box annotations? It’s strange because my model is still working. Though not very well.

Very confused by it all. Why doesn’t the cocodataset label the test images?

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

Categories
Misc

Tensorflow Probability: BatchNormalization Bijector Wrong Result with "prob" method

I am trying to implement a normalizing flow according to the RealNVP model for density estimation. First, I am trying to make it work on the “moons” toy dataset.

The model produces the expected result when not using the BatchNormalization bijector. However, when adding the BatchNormalization bijector to the model, the methods prob and log_prob return unexpected results.

Following is a code snippet setting up the model:

“`python layers = 6 dimensions = 2 hidden_units = [512, 512] bijectors = []

base_dist = tfd.Normal(loc=0.0, scale=1.0) # specify base distribution

for i in range(layers): # Adding the BatchNormalization bijector corrupts the results bijectors.append(tfb.BatchNormalization()) bijectors.append(RealNVP(input_shape=dimensions, n_hidden=hidden_units)) bijectors.append(tfp.bijectors.Permute([1, 0]))

bijector = tfb.Chain(bijectors=list(reversed(bijectors))[:-1], name=’chain_of_real_nvp’)

flow = tfd.TransformedDistribution( distribution=tfd.Sample(base_dist, sample_shape=[dimensions]), bijector=bijector ) “`

When to BatchNormalization bijector is omitted both sampling and evaluating the probability return expected results:

Heatmap of probabilities and samples without BN

However, when the BatchNormalization bijector is added, sampling is as expected but evaluating the probability seems wrong:

Heatmap of probabilities and samples with BN

Because I am interested in density estimation the prob method is crucial. The full code can be found in the following jupyter notebook: https://github.com/mmsbrggr/normalizing-flows/blob/master/moons_training_rnvp.ipynb

I know that the BatchNormalization bijector behaves differently during training and inference. Could the problem be that the BN bijector is still in training mode? If so how can I move the flow to inference mode?

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

Categories
Misc

Getting an error during Concatenation while employing Attention to my seq2seq model?

Hi everyone,

I’m trying to implement my own seq2seq model and employ the widely recommended attention layer on it. Oddly getting an error during the concatenation like below:

2 frames/usr/local/lib/python3.7/dist-packages/tensorflow/python/eager/execute.py in quick_execute(op_name, num_outputs, inputs, attrs, ctx, name)53 ctx.ensure_initialized()54 tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,—> 55 inputs, attrs, num_outputs)56 except core._NotOkStatusException as e:57 if name is not None:InvalidArgumentError: Graph execution error:Detected at node ‘model_3/concat_layer/concat’ defined at (most recent call last):File “/usr/lib/python3.7/runpy.py”, line 193, in _run_module_as_main”__main__”, mod_spec)File “/usr/lib/python3.7/runpy.py”, line 85, in _run_codeexec(code, run_globals)File “/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py”, line 16, in <module>app.launch_new_instance()File “/usr/local/lib/python3.7/dist-packages/traitlets/config/application.py”, line 846, in launch_instanceapp.start()File “/usr/local/lib/python3.7/dist-packages/ipykernel/kernelapp.py”, line 499, in startself.io_loop.start()File “/usr/local/lib/python3.7/dist-packages/tornado/platform/asyncio.py”, line 132, in startself.asyncio_loop.run_forever()File “/usr/lib/python3.7/asyncio/base_events.py”, line 541, in run_foreverself._run_once()File “/usr/lib/python3.7/asyncio/base_events.py”, line 1786, in _run_oncehandle._run()File “/usr/lib/python3.7/asyncio/events.py”, line 88, in _runself._context.run(self._callback, *self._args)File “/usr/local/lib/python3.7/dist-packages/tornado/platform/asyncio.py”, line 122, in _handle_eventshandler_func(fileobj, events)File “/usr/local/lib/python3.7/dist-packages/tornado/stack_context.py”, line 300, in null_wrapperreturn fn(*args, **kwargs)File “/usr/local/lib/python3.7/dist-packages/zmq/eventloop/zmqstream.py”, line 452, in _handle_eventsself._handle_recv()File “/usr/local/lib/python3.7/dist-packages/zmq/eventloop/zmqstream.py”, line 481, in _handle_recvself._run_callback(callback, msg)File “/usr/local/lib/python3.7/dist-packages/zmq/eventloop/zmqstream.py”, line 431, in _run_callbackcallback(*args, **kwargs)File “/usr/local/lib/python3.7/dist-packages/tornado/stack_context.py”, line 300, in null_wrapperreturn fn(*args, **kwargs)File “/usr/local/lib/python3.7/dist-packages/ipykernel/kernelbase.py”, line 283, in dispatcherreturn self.dispatch_shell(stream, msg)File “/usr/local/lib/python3.7/dist-packages/ipykernel/kernelbase.py”, line 233, in dispatch_shellhandler(stream, idents, msg)File “/usr/local/lib/python3.7/dist-packages/ipykernel/kernelbase.py”, line 399, in execute_requestuser_expressions, allow_stdin)File “/usr/local/lib/python3.7/dist-packages/ipykernel/ipkernel.py”, line 208, in do_executeres = shell.run_cell(code, store_history=store_history, silent=silent)File “/usr/local/lib/python3.7/dist-packages/ipykernel/zmqshell.py”, line 537, in run_cellreturn super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)File “/usr/local/lib/python3.7/dist-packages/IPython/core/interactiveshell.py”, line 2718, in run_cellinteractivity=interactivity, compiler=compiler, result=result)File “/usr/local/lib/python3.7/dist-packages/IPython/core/interactiveshell.py”, line 2822, in run_ast_nodesif self.run_code(code, result):File “/usr/local/lib/python3.7/dist-packages/IPython/core/interactiveshell.py”, line 2882, in run_codeexec(code_obj, self.user_global_ns, self.user_ns)File “<ipython-input-15-f9cbfc42a957>”, line 491, in <module>train()File “<ipython-input-15-f9cbfc42a957>”, line 321, in train1)[:, 1:]))File “/usr/local/lib/python3.7/dist-packages/keras/utils/traceback_utils.py”, line 64, in error_handlerreturn fn(*args, **kwargs)File “/usr/local/lib/python3.7/dist-packages/keras/engine/training.py”, line 1384, in fittmp_logs = self.train_function(iterator)File “/usr/local/lib/python3.7/dist-packages/keras/engine/training.py”, line 1021, in train_functionreturn step_function(self, iterator)File “/usr/local/lib/python3.7/dist-packages/keras/engine/training.py”, line 1010, in step_functionoutputs = model.distribute_strategy.run(run_step, args=(data,))File “/usr/local/lib/python3.7/dist-packages/keras/engine/training.py”, line 1000, in run_stepoutputs = model.train_step(data)File “/usr/local/lib/python3.7/dist-packages/keras/engine/training.py”, line 859, in train_stepy_pred = self(x, training=True)File “/usr/local/lib/python3.7/dist-packages/keras/utils/traceback_utils.py”, line 64, in error_handlerreturn fn(*args, **kwargs)File “/usr/local/lib/python3.7/dist-packages/keras/engine/base_layer.py”, line 1096, in __call__outputs = call_fn(inputs, *args, **kwargs)File “/usr/local/lib/python3.7/dist-packages/keras/utils/traceback_utils.py”, line 92, in error_handlerreturn fn(*args, **kwargs)File “/usr/local/lib/python3.7/dist-packages/keras/engine/functional.py”, line 452, in callinputs, training=training, mask=mask)File “/usr/local/lib/python3.7/dist-packages/keras/engine/functional.py”, line 589, in _run_internal_graphoutputs = node.layer(*args, **kwargs)File “/usr/local/lib/python3.7/dist-packages/keras/utils/traceback_utils.py”, line 64, in error_handlerreturn fn(*args, **kwargs)File “/usr/local/lib/python3.7/dist-packages/keras/engine/base_layer.py”, line 1096, in __call__outputs = call_fn(inputs, *args, **kwargs)File “/usr/local/lib/python3.7/dist-packages/keras/utils/traceback_utils.py”, line 92, in error_handlerreturn fn(*args, **kwargs)File “/usr/local/lib/python3.7/dist-packages/keras/layers/merge.py”, line 183, in callreturn self._merge_function(inputs)File “/usr/local/lib/python3.7/dist-packages/keras/layers/merge.py”, line 531, in _merge_functionreturn backend.concatenate(inputs, axis=self.axis)File “/usr/local/lib/python3.7/dist-packages/keras/backend.py”, line 3313, in concatenatereturn tf.concat([to_dense(x) for x in tensors], axis)Node: ‘model_3/concat_layer/concat’ConcatOp : Dimension 1 in both shapes must be equal: shape[0] = [128,7,300] vs. shape[1] = [128,128,300][[{{node model_3/concat_layer/concat}}]] [Op:__inference_train_function_43001]

You can reach the whole Python code from here: https://pastebin.pl/view/16b32d92 (I could not share it here as it was too long to be included here).

Could you please help me to find out what I’m missing?

Many many thanks in advance!

p.s. I’m using Keras for the implementation.

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

Categories
Misc

What Is a Transformer Model?

If you want to ride the next big wave in AI, grab a transformer. They’re not the shape-shifting toy robots on TV or the trash-can-sized tubs on telephone poles. So, What’s a Transformer Model? A transformer model is a neural network that learns context and thus meaning by tracking relationships in sequential data like the Read article >

The post What Is a Transformer Model? appeared first on NVIDIA Blog.

Categories
Misc

NVIDIA Research Turns 2D Photos Into 3D Scenes in the Blink of an AI

When the first instant photo was taken 75 years ago with a Polaroid camera, it was groundbreaking to rapidly capture the 3D world in a realistic 2D image. Today, AI researchers are working on the opposite: turning a collection of still images into a digital 3D scene in a matter of seconds. Known as inverse Read article >

The post NVIDIA Research Turns 2D Photos Into 3D Scenes in the Blink of an AI appeared first on NVIDIA Blog.