Categories
Misc

Neural Network getting 0 accuracy, and always predicting very high values

When I printed out the prediction, and the actual value side by side

[0.9785253] 6 [0.97852457] 5 [0.9785253] 6 [0.9785253] 5 [0.97848856] 6 [0.9785253] 7 [0.9785253] 5 [0.9785253] 7 

thats what it looked like, the value in bracket is the prediction, the other the actual one!

Have no clue why this is doing this, can you help please!!

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

Categories
Misc

Gradients do not exist warning

I’ve tried to implement Yolov3 network by tf.keras, making it layer-by-layer. Then, I get outputs of layers 82, 94, 106, and pass them (and also – three training inputs with ground truth bounding boxes for every network stride) into Lambda layer to evaluate loss of net. However, when I try to train the network, I receive the warning: “WARNING:tensorflow:Gradients do not exist for variables [‘Layer_Conv_81/kernel:0’, ‘Layer_Conv_91/kernel:0’, ‘Layer_Batch_81/gamma:0’, ‘Layer_Batch_81/beta:0’, ‘Layer_Batch_91/gamma:0’, ‘Layer_Batch_91/beta:0’, ‘Output_1/kernel:0’, ‘Output_2/kernel:0’] when minimizing the loss. If you’re using `model.compile()`, did you forget to provide a `loss`argument?”

I’ve checked the sequence of layers – there are no unconnected ones, I have the loss function. What else could go wrong?

Brief version of code here:

def MakeYoloMainStructure(): inputImage = Input(shape=(IMAGE_SIDES[0], IMAGE_SIDES[1], 3), name='Main_Input') # Start placing layers layer1_1 = Conv2D(32, (3,3), strides=(1,1), use_bias=False, padding='same', name='Layer_Conv_1')(inputImage) layer1_2 = BatchNormalization(epsilon=eps, name='Layer_Batch_1')(layer1_1) layer1_3 = LeakyReLU(alpha=alp, name='Layer_Leaky_1')(layer1_2) # Start placing adding layers # Layer 1 - 64/1 layer2_1 = ZeroPadding2D(((1,0),(1,0)), name='Layer_ZeroPad_2')(layer1_3) layer2_2 = Conv2D(64, (3,3), strides=(2,2), use_bias=False, padding='valid', name='Layer_Conv_2')(layer2_1) layer2_3 = BatchNormalization(epsilon=eps, name='Layer_Batch_2')(layer2_2) layer2_4 = LeakyReLU(alpha=alp, name='Layer_Leaky_2')(layer2_3) ... layer80_2 = BatchNormalization(epsilon=eps, name='Layer_Batch_80')(layer80_1) layer80_3 = LeakyReLU(alpha=alp, name='Layer_Leaky_80')(layer80_2) layer81_1 = Conv2D(1024, (3,3), strides=(1,1), use_bias=False, padding='same', name='Layer_Conv_81')(layer80_3) # From this layer we make fork for first output (!) layer81_2 = BatchNormalization(epsilon=eps, name='Layer_Batch_81')(layer81_1) layer81_3 = LeakyReLU(alpha=alp, name='Layer_Leaky_81')(layer81_2) layer82_1 = Conv2D(3*6, (1,1), strides=(1,1), use_bias=False, padding='same', name='Output_1')(layer81_3) # FIRST output layer (!) layer84_1 = layer80_3 layer85_1 = Conv2D(256, (1,1), strides=(1,1), use_bias=False, padding='same', name='Layer_Conv_83')(layer84_1) ..... layer106_1 = Conv2D(3*6, (1,1), strides=(1,1), use_bias=False, padding='same', name='Output_3')(layer105_3) # THIRD output layer (!) # Net structure is completed yoloBoneModel = Model(inputImage, [layer82_1, layer94_1, layer106_1]) return yoloBoneModel def MakeYoloTrainStructure(yoloBoneModel): gridInput_all = [Input(shape=(GRID_SIDES[1], GRID_SIDES[1], 3, 6), name='Grid_Input_1'), Input(shape=(GRID_SIDES[2], GRID_SIDES[2], 3, 6), name='Grid_Input_2'), Input(shape=(GRID_SIDES[3], GRID_SIDES[3], 3, 6), name='Grid_Input_3')] layer_loss = Lambda(GetLoss, output_shape=(1,), name='GetLoss', arguments={'threshold': thresh})([*yoloBoneModel.output, *gridInput_all]) yoloTrainModel = Model([yoloBoneModel.input, *gridInput_all], layer_loss) return yoloTrainModel def GetLoss(args, threshold=0.5): modelOutputs = args[:3] checkInputs = args[3:] # ...... # Numerous manipulations to get loss of objects detection # ...... return loss def GetDataGenerator(batches): # Here I get image and ground truth Bounding Boxes data yield [imageData, *trueBoxes], np.zeros(batches) def main(): boneModel = MakeYoloMainStructure() trainModel = MakeYoloTrainStructure(boneModel) trainModel.compile(optimizer=Adam(lr=1e-3), loss={'GetLoss': lambda gridInput_all, y_pred: y_pred}, run_eagerly=True) batchSize = 32 trainModel.fit(GetDataGenerator(batchSize), steps_per_epoch=2000//batchSize, epochs=50, initial_epoch=0) 

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

Categories
Misc

How to load a model after it’s been saved?

How to load a model after it's been saved?

Tried using this for reference but it wasn’t working. Saving the model seems to work perfectly fine. Screenshots go in this order: 1. Code that trains and saves the model. 2. what the saved model looks like in the file directory. 3. Code that should load the model back and then test it. 4. Error message received when load/test code is run. How do I properly load my model back so it can be evaluated? Or is it that I’m improperly saving it?

1. Train and Save Code

2. File Directory (Saving every 100 epochs)

3. Load and Test Code

4. Console Error from 3.

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

Categories
Misc

using ROCm for tensorflow on RX 6000 series radeon cards.

Sorry if this was asked recently. I used google to search for this and pretty much only got old information. I know recently rdna 2 is supposed to work with ROCm but no one benchmarks the results.

I am looking to buy a new laptop soon and was hoping to get something in the “ultra portable” category with good battery life. Something with a 6800U or 6900HS. I had not been planning on getting one with a discrete gpu but the new Asus Zephyrus 14 has a 6800S, is fairly small considering, gets 8 to 10 hours on battery. Might get a lenovo Z13 if the price is right when it releases.

I mostly just ssh into my desktop at home so I am not buying the laptop specifically for deep learning but I cant find anything I quite want in the laptop space with a 3060/3070. Obviously I would only do small test type work if I ever have to run it on the laptop and cpu training is possible, but would a 6800S gpu or maybe even the 680m onboard graphics train faster than the cpu?

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

Categories
Misc

Training TensorFlow models with HUGE datasets

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

Categories
Misc

TF 1.x with CUDA 11.x

How can I install TF 1.x with CUDA 11.x with GPU support (for RTX 3xxx series)? All tutorials are outdated today. Wanna run a Mask R-CNN. Even the one with TF 2.x support, doesnt work with CUDA 11.x, rather than with CUDA 10.x

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

Categories
Misc

How to create a layer without an Input.

Hi,

In deep rl algorithm like PPO, a continuous stochastic policy is represented by Normal Distribution. For this the recommended way of creating a Normal Distribution is to get the mean by passing the state through NN and then using a state independent layer to predict log_std. This layer which predicts log_std should be trainable using backprop just like biases. So how to create this layer in tensorflow 2.

submitted by /u/Better-Ad8608
[visit reddit] [comments]

Categories
Misc

Question on appropriate CUDA version installation

Short question: Do apps work with a higher version of CUDA if they specified a lower version as requirement? Or should I exactly match the version?

Extra explanations: I want to use GPU in TF and Matlab. The first one says I need CUDA 11.2 and the second one mentions CUDA 10.1. Currently the latest available CUDA drivers are 11.6.1. Can I just install the latest version and hope they all work well?

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

Categories
Misc

Switch CUDA versions

I am trying to run a project which only supports tf 2.2, but I have CUDA 11.x which is not supported by TF 2.2 for GPU support. Is there a way to install CUDA 10.1 and 11.6 and switch between them?

Edit: RTX 3xxx support CUDA 11.x. The repository (Mask R-CNN support TF 2.2, which works with CUDA 10.x for GPU support). I realise I cannot train with GPU…

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

Categories
Misc

Tensorflow Certification Test text embedding

Hi, is it valid to use pretrained text embeddings ?Ike Universal Sentence Encoder.

Also in the text they expect us to achieve 90 accuracy or higher in all the problems?

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