Comments (19)
@mahirahzainipderas it looks like you're facing the problem of daying gradients with ReLu activation function (that what NaN means -- very small activations). If you use model.compile(loss=yolo_loss_func , optimizer=opt , metrics = ['accuracy'])
the metric isn't correct in this context instead just orient your focus for decreasing loss.
inp = Input(input_shape)
model = MobileNetV2(
input_tensor=inp, include_top=False, weights='imagenet')
last_layer = model.output
conv = Conv2D(512, (3, 3), activation=tf.nn.leaky_relu,
padding='same')(last_layer)
conv = Dropout(0.4)(conv)
bn = BatchNormalization()(conv)
lr = LeakyReLU(alpha=0.1)(bn)
conv = Conv2D(128, (3, 3), activation=tf.nn.leaky_relu, padding='same')(lr)
conv = Dropout(0.4)(conv)
bn = BatchNormalization()(conv)
lr = LeakyReLU(alpha=0.1)(bn)
conv = Conv2D(5, (3, 3), activation=tf.nn.leaky_relu, padding='same')(lr)
final = Reshape((grid_h, grid_w, classes, info))(conv)
model = Model(inp, final)
from text-detection-using-yolo-algorithm-in-keras-tensorflow.
@mahirahzainipderas it looks like you're facing the problem of daying gradients with ReLu activation function (that what NaN means -- very small activations). If you use
model.compile(loss=yolo_loss_func , optimizer=opt , metrics = ['accuracy'])
the metric isn't correct in this context instead just orient your focus for decreasing loss.inp = Input(input_shape) model = MobileNetV2( input_tensor=inp, include_top=False, weights='imagenet') last_layer = model.output conv = Conv2D(512, (3, 3), activation=tf.nn.leaky_relu, padding='same')(last_layer) conv = Dropout(0.4)(conv) bn = BatchNormalization()(conv) lr = LeakyReLU(alpha=0.1)(bn) conv = Conv2D(128, (3, 3), activation=tf.nn.leaky_relu, padding='same')(lr) conv = Dropout(0.4)(conv) bn = BatchNormalization()(conv) lr = LeakyReLU(alpha=0.1)(bn) conv = Conv2D(5, (3, 3), activation=tf.nn.leaky_relu, padding='same')(lr) final = Reshape((grid_h, grid_w, classes, info))(conv) model = Model(inp, final)
Updating the activation functions worked for me. Thanks!
from text-detection-using-yolo-algorithm-in-keras-tensorflow.
I'll need some more info. Are you using the exact same code, data and loss function ?
from text-detection-using-yolo-algorithm-in-keras-tensorflow.
Everything is the same except for different dataset
from text-detection-using-yolo-algorithm-in-keras-tensorflow.
My accuracy shoot up to 100% after just one epoch
from text-detection-using-yolo-algorithm-in-keras-tensorflow.
Check your X.npy and Y.npy files. Make sure the data inside are clean (No '\n' or extra characters etc.) .
from text-detection-using-yolo-algorithm-in-keras-tensorflow.
I have the same error with the same dataset and code with loss of nan
from text-detection-using-yolo-algorithm-in-keras-tensorflow.
I have also face the same ERROR i.e., "val_loss did not improve from inf" and find accuracy and validation loss as "nan". Kindly suggest the proper solution for it. I have used the same code with the same dataset provided in your repository.
from text-detection-using-yolo-algorithm-in-keras-tensorflow.
I think that the code has been written for another version of python that you use (python 3)? I got the same problem. I took a look at the code, and a bit of work have to be done to make it compatible with python 2/3 (some division operators need to be fixed). Can you confirm @Neerajj9 ?
from text-detection-using-yolo-algorithm-in-keras-tensorflow.
I've got the same issue, any updates?
from text-detection-using-yolo-algorithm-in-keras-tensorflow.
The problem was in inactivation function 'relu' . It can be fix as: 'activation=tf.nn.leaky_relu' or 'activation=tf.nn.elu'. I've achived the same result after 100 epochs.
from text-detection-using-yolo-algorithm-in-keras-tensorflow.
can you explain more @goldengrisha ? I go both loss and val_loss nan and val_acc at 1. Seems incorrect for training data.
from text-detection-using-yolo-algorithm-in-keras-tensorflow.
Hi,
I am facing this problem now. I tried @goldengrisha tip but still got nan after the first step.
Any updates?
from text-detection-using-yolo-algorithm-in-keras-tensorflow.
Hello, @noarotman what version of TF do you use?
from text-detection-using-yolo-algorithm-in-keras-tensorflow.
@goldengrisha I use the version that was written in "readme" file: Tensorflow : 1.9.0
and I run this on CPU..
from text-detection-using-yolo-algorithm-in-keras-tensorflow.
@noarotman try switching to TF 2.1 and check the code above, it should work.
from text-detection-using-yolo-algorithm-in-keras-tensorflow.
@goldengrisha thanks I will try.
another issue is that when I try to run the yolo model I get this error:
from text-detection-using-yolo-algorithm-in-keras-tensorflow.
@noarotman, you're welcome, please check the last URL, it can be wrong.
from text-detection-using-yolo-algorithm-in-keras-tensorflow.
Hello everyone, the code was written in python3 and the exact versions mentioned in the README.md file. There might be some compatibility issues as @goldengrisha pointed out which might be because of a different version of tensorflow or keras. Also yes concentrate on the decreasing loss as against the 'accuracy' metric.
from text-detection-using-yolo-algorithm-in-keras-tensorflow.
Related Issues (8)
- How does the model deal with images of different sizes
- problem HOT 1
- No accuracy improvements HOT 2
- NPY files are becoming huge after preprocessing HOT 2
- ValueError: You are trying to load a weight file containing 109 layers into a model with 59 layers.
- Accuracy is low
- Help loss go to infinite HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from text-detection-using-yolo-algorithm-in-keras-tensorflow.