Categories
Misc

LSTM Tensorflow Input/Output Dimensions

I’m a little confused by what I’m getting vs. what I’m
expecting. I’m using Tensorflow 2.1 in Python 3.7 in Anaconda
3-2020.07

Here’s my problem:

  1. I want my output to be the next value in an hour-by-hour time
    series.
  2. My input has 99 features.
  3. I have 24,444 data points for training. Some of the data was
    corrupted/reserved for validation.

I’m trying to build a 2 layer deep neural network using LSTM
layers:

model = Sequential() model.add(tensorflow.keras.layers.LSTM(64,
return_sequences=True, input_dim=99))

model.add(tensorflow.keras.layers.LSTM(32,
return_sequences=True))

model.add(tensorflow.keras.layers.Dense(1)

I plan to give it sets of data with 72 hours (3 days) of
sequential training.

So when I give my model training data:

model.fit(X_data, Y_data,
…)

I planned on giving X_data with dimensions of size [24444, 72,
99], where the first dimension 24444 describes the data points, the
72 describes the 72 hours of history, and the 99 describes my
training features.

My Y_data has dimensions of size [24444, 72, 1] where first
dimension 24444 describes my training points, 72 describes the
history, and 1 is my output feature.

My question is, when training is done, and I’m actively using my
model for predictions, what should my production input size be?

prediction = model.predict(production_data)

Should my production size be [1, 72, 99]? Where 1 is the number
of output points I expect, 72 is my history, and 99 my feature
size?

When I do this, I get an output size of [72, 1]. That feels…
weird?

What is the difference between feeding my model input of [72, 1,
99] vs [1, 72, 99]? Does the first case not proprogate the internal
state forward?

If I give my model [1, 1, 99] do I need to loop my model
predictions? And how would I do this?

submitted by /u/jyliu86

[visit reddit]

[comments]

Categories
Misc

Help!

How do I make an image classifier with size (200,200,1) perform
well I am only getting 30% accuracy is it due to my hardware I dont
have a gpu

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

Categories
Misc

Mask Detection on Raspberry Pi with Stepper Motor Access Control Tutorial


Mask Detection on Raspberry Pi with Stepper Motor Access Control Tutorial
submitted by /u/AugmentedStartups

[visit reddit]

[comments]
Categories
Misc

I am new to tensorflow, and I am confused abt this section of the code. Can someone briefly explain this to me, I appreciate it.

plt.figure(figsize=(10,10)) 

for i in range(25): plt.subplot(5,5,i+1) plt.xticks([])
plt.yticks([]) plt.grid(False) plt.imshow(train_images[i],
cmap=plt.cm.binary) plt.xlabel(class_names[train_labels[i]])
plt.show()

submitted by /u/Real_Scholar2762

[visit reddit]

[comments]

Categories
Misc

Pass empty directory to tf.train.get_checkpoint_state()

Hello, I’m completely new to tensorflow. Right now I’m trying
out a
training script
on two different datasets using tensorflow
1.13.0, and got stuck when it was trying to pass an empty directory
PRETRAINED_MODEL_PATH to
tf.train.get_checkpoint_state(PRETRAINED_MODEL_PATH),

PRETRAINED_MODEL_PATH = '' saver = tf.train.Saver([v for v in tf.get_collection_ref(tf.GraphKeys.GLOBAL_VARIABLES) if('lr' not in v.name) and ('batch' not in v.name)]) ckptstate = tf.train.get_checkpoint_state(PRETRAINED_MODEL_PATH) 

The two datasets are getting two different responses when
passing an empty directory to tf.train.get_checkpoint_state(). The
first dataset I tried outputs a warning, but the training
continues.

WARNING:tensorflow:FailedPreconditionError: checkpoint; Is a directory WARNING:tensorflow:checkpoint: Checkpoint ignored 

The second dataset I tried outputs an error and script ends.

Traceback (most recent call last): File "cam_est/train_sdf_cam.py", line 827, in <module> train() File "cam_est/train_sdf_cam.py", line 495, in train ckptstate = tf.train.get_checkpoint_state(PRETRAINED_MODEL_PATH) File "/home/jg/anaconda3/envs/tf_trimesh/lib/python3.6/site-packages/tensorflow/python/training/checkpoint_management.py", line 278, in get_checkpoint_state + checkpoint_dir) ValueError: Invalid checkpoint state loaded from 

I have tried everything I can think of but still can’t figure
out the problem. Can someone help please?

submitted by /u/HistoricalTouch0

[visit reddit]

[comments]

Categories
Misc

"Unhandled Rejection Error, The Implicit Shape can not be a fractional number "


"Unhandled Rejection Error, The Implicit Shape can not be a fractional number "

Hello everyone, sos

I am following an online tutorial on how to run gesture
recognition using react and tensor flow. However, I am always
seeing this error whenever I play around with the webcam in
chrome.

Here is my github for what I am working on btw. And here is the
tutorial video I’m watching. I got stuck right around minute 10

https://github.com/riccrdo5/help

https://youtu.be/f7uBsb-0sGQ

Ty and happy holidays


https://preview.redd.it/3y923uvvc6961.png?width=1366&format=png&auto=webp&s=557aed6e1faac7e38150189582dba9796f4a044c


https://preview.redd.it/ateyqtvvc6961.jpg?width=960&format=pjpg&auto=webp&s=ffed821126f1e56f9d2ae1b9562e37a2de85f7a4

submitted by /u/RicardoCarlos55

[visit reddit]

[comments]

Categories
Misc

ValueError: Negative dimension size caused by subtracting 2 from 1

def get_model_2(input_shape): model = Sequential() model.add(Conv2D(64, (5, 5), activation='relu', input_shape=input_shape)) model.add(MaxPooling2D(pool_size=(3, 3))) model.add(Conv2D(128, (4, 4), activation='relu')) model.add(MaxPooling2D(pool_size=(2, 2))) model.add(Conv2D(512, (3, 3), activation='relu')) model.add(MaxPooling2D(pool_size=(2, 2))) model.add(Conv2D(512, (3, 3), activation='relu')) model.add(MaxPooling2D(pool_size=(2, 2))) # model.add(Conv2D(512, (3, 3), activation='relu')) # model.add(MaxPooling2D(pool_size=(2, 2))) model.add(Conv2D(512, (2, 2), activation='relu')) model.add(MaxPooling2D(pool_size=(2, 2))) model.add(Flatten()) model.add(Dense(512, activation='relu')) # model.add(Dropout(0.5)) model.add(Dense(1, activation='sigmoid')) return model 

Why do I get the following error when I un-comment that middle
layer?

ValueError: Negative dimension size caused by subtracting 2 from
1 for ‘{{node max_pooling2d_4/MaxPool}} = MaxPool[T=DT_FLOAT,
data_format=”NHWC”, explicit_paddings=[], ksize=[1, 2, 2, 1],
padding=”VALID”, strides=[1, 2, 2, 1]](Placeholder)’ with input
shapes: [?,1,1,512].

submitted by /u/BananaCharmer

[visit reddit]

[comments]

Categories
Misc

Trained a model w. Keras in Python w. custom loss function. How can I deploy it for inference with Tensorflow Serving – aka how to define a custom loss function or just disable that part?

I wrote a custom model using a custom loss function. The layers
are all basic keras layers but the loss function is a custom. How
do I move this to a high performance serving scenario? I don’t need
to do training – just prediction. Suggestions? Tutorials?

submitted by /u/i8code

[visit reddit]

[comments]

Categories
Misc

YOLOv4 Face Recognition on Custom Dataset


YOLOv4 Face Recognition on Custom Dataset
submitted by /u/TheCodingBug

[visit reddit]

[comments]
Categories
Misc

How to fix VQ-VAE postirior collapse?

Im Training a vq-vae on audio data (spectrograms), but the
posterior always collapses. Anyone an idea how to avoid that?

submitted by /u/Ramox_Phersu

[visit reddit]

[comments]