Training model in Keras(TF backend) with GPU Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Moderator Election Q&A - Questionnaire 2019 Community Moderator Election ResultsSwitching Keras backend Tensorflow to GPUMaking Keras + Tensorflow code execution deterministic on a GPUUsing TensorFlow with Intel GPUHow to transition between offline and online learning?Multi GPU in kerasLoss plateaus off in neural style transferIssue with Custom object detection using tensorflow when Training on a single type of objectTraining Inception V3 based model using Keras with Tensorflow Backendcan't install tensorflow with gpuUsing CPU after training in GPU

Significance of Cersei's obsession with elephants?

Does the Weapon Master feat grant you a fighting style?

Chinese Seal on silk painting - what does it mean?

What font is "z" in "z-score"?

Why aren't air breathing engines used as small first stages?

When a candle burns, why does the top of wick glow if bottom of flame is hottest?

Dating a Former Employee

Is it a good idea to use CNN to classify 1D signal?

Sum letters are not two different

Do wooden building fires get hotter than 600°C?

SF book about people trapped in a series of worlds they imagine

If my PI received research grants from a company to be able to pay my postdoc salary, did I have a potential conflict interest too?

How do living politicians protect their readily obtainable signatures from misuse?

Is this homebrew Lady of Pain warlock patron balanced?

What does the "x" in "x86" represent?

Has negative voting ever been officially implemented in elections, or seriously proposed, or even studied?

Can anything be seen from the center of the Boötes void? How dark would it be?

How would a mousetrap for use in space work?

Did MS DOS itself ever use blinking text?

How does the math work when buying airline miles?

How do I use the new nonlinear finite element in Mathematica 12 for this equation?

How to tell that you are a giant?

What is the effect of altitude on true airspeed?

What is the meaning of the simile “quick as silk”?



Training model in Keras(TF backend) with GPU



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
2019 Moderator Election Q&A - Questionnaire
2019 Community Moderator Election ResultsSwitching Keras backend Tensorflow to GPUMaking Keras + Tensorflow code execution deterministic on a GPUUsing TensorFlow with Intel GPUHow to transition between offline and online learning?Multi GPU in kerasLoss plateaus off in neural style transferIssue with Custom object detection using tensorflow when Training on a single type of objectTraining Inception V3 based model using Keras with Tensorflow Backendcan't install tensorflow with gpuUsing CPU after training in GPU










1












$begingroup$


I want to train my custom dataset for licence plate detection. I have 2000 image for this. First, I trained my labelling dataset in Keras (TF backend) with CPU.




optimizer : Adam, learning rate : 0.01 , batch size = 64,
iteration:100000




In this case, my training period exceeded 10 days, loss is 10. When I tested the model could detect licence plates. (acc : 80%)



Then, I decided to train with gpu because of the training period is too long.



I uninstall tensorflow and I install tensorflow-gpu(1.13), Cuda(10.0) and Cudnn(7.4) and I added these codes:



config = tf.ConfigProto()
config.gpu_options.allow_growth = True
session = tf.InteractiveSession(config=config)


In this time, when I use the same values (Adam, lr=0.01, itr=100000, bs=64), loss value decreases very fast every iteration (loss begins with 210 and ends 0.000000). The training ends in four-five hours. But when I tested, my model could not detect any licence plate.



I try to change values. I did learning rate = 0.000001, iteration =3000 so that the loss is 0.7, training ends 10-20 minutes, but model detects very wrong. (and I know this number is very bad for learning rate)



My GPU : GeForce RTX 2080



How can I optimize these numbers, where is my mistake?



Thank you.










share|improve this question









$endgroup$







  • 3




    $begingroup$
    The fact you perform the training on a CPU or on a GPU wouldn't affect the results, more over from 80% to 0%. It seems to me, than when you are using the GPU, you are not testing the model with the learned weights... Are you sure you are not closing the tf.Session() or you are not restoring the weights?
    $endgroup$
    – ignatius
    Apr 3 at 9:24










  • $begingroup$
    thank you, I think so too, the training on a CPU or on a GPU souldn't affect the results. but according to my results it does. actually I dont understand why is the final loss value is different when training with Gpu and Cpu with the same values? i think my learning rate and batch size values are wrong, because when I changed these numbers training with gpu, my model can detect something but wrong, at least it tries. (so, the problem should not relate to weights) i dont know how to optimize learning rate and batch size training with gpu.
    $endgroup$
    – little_learning_rate
    Apr 3 at 11:06















1












$begingroup$


I want to train my custom dataset for licence plate detection. I have 2000 image for this. First, I trained my labelling dataset in Keras (TF backend) with CPU.




optimizer : Adam, learning rate : 0.01 , batch size = 64,
iteration:100000




In this case, my training period exceeded 10 days, loss is 10. When I tested the model could detect licence plates. (acc : 80%)



Then, I decided to train with gpu because of the training period is too long.



I uninstall tensorflow and I install tensorflow-gpu(1.13), Cuda(10.0) and Cudnn(7.4) and I added these codes:



config = tf.ConfigProto()
config.gpu_options.allow_growth = True
session = tf.InteractiveSession(config=config)


In this time, when I use the same values (Adam, lr=0.01, itr=100000, bs=64), loss value decreases very fast every iteration (loss begins with 210 and ends 0.000000). The training ends in four-five hours. But when I tested, my model could not detect any licence plate.



I try to change values. I did learning rate = 0.000001, iteration =3000 so that the loss is 0.7, training ends 10-20 minutes, but model detects very wrong. (and I know this number is very bad for learning rate)



My GPU : GeForce RTX 2080



How can I optimize these numbers, where is my mistake?



Thank you.










share|improve this question









$endgroup$







  • 3




    $begingroup$
    The fact you perform the training on a CPU or on a GPU wouldn't affect the results, more over from 80% to 0%. It seems to me, than when you are using the GPU, you are not testing the model with the learned weights... Are you sure you are not closing the tf.Session() or you are not restoring the weights?
    $endgroup$
    – ignatius
    Apr 3 at 9:24










  • $begingroup$
    thank you, I think so too, the training on a CPU or on a GPU souldn't affect the results. but according to my results it does. actually I dont understand why is the final loss value is different when training with Gpu and Cpu with the same values? i think my learning rate and batch size values are wrong, because when I changed these numbers training with gpu, my model can detect something but wrong, at least it tries. (so, the problem should not relate to weights) i dont know how to optimize learning rate and batch size training with gpu.
    $endgroup$
    – little_learning_rate
    Apr 3 at 11:06













1












1








1





$begingroup$


I want to train my custom dataset for licence plate detection. I have 2000 image for this. First, I trained my labelling dataset in Keras (TF backend) with CPU.




optimizer : Adam, learning rate : 0.01 , batch size = 64,
iteration:100000




In this case, my training period exceeded 10 days, loss is 10. When I tested the model could detect licence plates. (acc : 80%)



Then, I decided to train with gpu because of the training period is too long.



I uninstall tensorflow and I install tensorflow-gpu(1.13), Cuda(10.0) and Cudnn(7.4) and I added these codes:



config = tf.ConfigProto()
config.gpu_options.allow_growth = True
session = tf.InteractiveSession(config=config)


In this time, when I use the same values (Adam, lr=0.01, itr=100000, bs=64), loss value decreases very fast every iteration (loss begins with 210 and ends 0.000000). The training ends in four-five hours. But when I tested, my model could not detect any licence plate.



I try to change values. I did learning rate = 0.000001, iteration =3000 so that the loss is 0.7, training ends 10-20 minutes, but model detects very wrong. (and I know this number is very bad for learning rate)



My GPU : GeForce RTX 2080



How can I optimize these numbers, where is my mistake?



Thank you.










share|improve this question









$endgroup$




I want to train my custom dataset for licence plate detection. I have 2000 image for this. First, I trained my labelling dataset in Keras (TF backend) with CPU.




optimizer : Adam, learning rate : 0.01 , batch size = 64,
iteration:100000




In this case, my training period exceeded 10 days, loss is 10. When I tested the model could detect licence plates. (acc : 80%)



Then, I decided to train with gpu because of the training period is too long.



I uninstall tensorflow and I install tensorflow-gpu(1.13), Cuda(10.0) and Cudnn(7.4) and I added these codes:



config = tf.ConfigProto()
config.gpu_options.allow_growth = True
session = tf.InteractiveSession(config=config)


In this time, when I use the same values (Adam, lr=0.01, itr=100000, bs=64), loss value decreases very fast every iteration (loss begins with 210 and ends 0.000000). The training ends in four-five hours. But when I tested, my model could not detect any licence plate.



I try to change values. I did learning rate = 0.000001, iteration =3000 so that the loss is 0.7, training ends 10-20 minutes, but model detects very wrong. (and I know this number is very bad for learning rate)



My GPU : GeForce RTX 2080



How can I optimize these numbers, where is my mistake?



Thank you.







keras tensorflow gpu






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Apr 3 at 9:11









little_learning_ratelittle_learning_rate

82




82







  • 3




    $begingroup$
    The fact you perform the training on a CPU or on a GPU wouldn't affect the results, more over from 80% to 0%. It seems to me, than when you are using the GPU, you are not testing the model with the learned weights... Are you sure you are not closing the tf.Session() or you are not restoring the weights?
    $endgroup$
    – ignatius
    Apr 3 at 9:24










  • $begingroup$
    thank you, I think so too, the training on a CPU or on a GPU souldn't affect the results. but according to my results it does. actually I dont understand why is the final loss value is different when training with Gpu and Cpu with the same values? i think my learning rate and batch size values are wrong, because when I changed these numbers training with gpu, my model can detect something but wrong, at least it tries. (so, the problem should not relate to weights) i dont know how to optimize learning rate and batch size training with gpu.
    $endgroup$
    – little_learning_rate
    Apr 3 at 11:06












  • 3




    $begingroup$
    The fact you perform the training on a CPU or on a GPU wouldn't affect the results, more over from 80% to 0%. It seems to me, than when you are using the GPU, you are not testing the model with the learned weights... Are you sure you are not closing the tf.Session() or you are not restoring the weights?
    $endgroup$
    – ignatius
    Apr 3 at 9:24










  • $begingroup$
    thank you, I think so too, the training on a CPU or on a GPU souldn't affect the results. but according to my results it does. actually I dont understand why is the final loss value is different when training with Gpu and Cpu with the same values? i think my learning rate and batch size values are wrong, because when I changed these numbers training with gpu, my model can detect something but wrong, at least it tries. (so, the problem should not relate to weights) i dont know how to optimize learning rate and batch size training with gpu.
    $endgroup$
    – little_learning_rate
    Apr 3 at 11:06







3




3




$begingroup$
The fact you perform the training on a CPU or on a GPU wouldn't affect the results, more over from 80% to 0%. It seems to me, than when you are using the GPU, you are not testing the model with the learned weights... Are you sure you are not closing the tf.Session() or you are not restoring the weights?
$endgroup$
– ignatius
Apr 3 at 9:24




$begingroup$
The fact you perform the training on a CPU or on a GPU wouldn't affect the results, more over from 80% to 0%. It seems to me, than when you are using the GPU, you are not testing the model with the learned weights... Are you sure you are not closing the tf.Session() or you are not restoring the weights?
$endgroup$
– ignatius
Apr 3 at 9:24












$begingroup$
thank you, I think so too, the training on a CPU or on a GPU souldn't affect the results. but according to my results it does. actually I dont understand why is the final loss value is different when training with Gpu and Cpu with the same values? i think my learning rate and batch size values are wrong, because when I changed these numbers training with gpu, my model can detect something but wrong, at least it tries. (so, the problem should not relate to weights) i dont know how to optimize learning rate and batch size training with gpu.
$endgroup$
– little_learning_rate
Apr 3 at 11:06




$begingroup$
thank you, I think so too, the training on a CPU or on a GPU souldn't affect the results. but according to my results it does. actually I dont understand why is the final loss value is different when training with Gpu and Cpu with the same values? i think my learning rate and batch size values are wrong, because when I changed these numbers training with gpu, my model can detect something but wrong, at least it tries. (so, the problem should not relate to weights) i dont know how to optimize learning rate and batch size training with gpu.
$endgroup$
– little_learning_rate
Apr 3 at 11:06










0






active

oldest

votes












Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "557"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f48501%2ftraining-model-in-kerastf-backend-with-gpu%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Data Science Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f48501%2ftraining-model-in-kerastf-backend-with-gpu%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Adding axes to figuresAdding axes labels to LaTeX figuresLaTeX equivalent of ConTeXt buffersRotate a node but not its content: the case of the ellipse decorationHow to define the default vertical distance between nodes?TikZ scaling graphic and adjust node position and keep font sizeNumerical conditional within tikz keys?adding axes to shapesAlign axes across subfiguresAdding figures with a certain orderLine up nested tikz enviroments or how to get rid of themAdding axes labels to LaTeX figures

Tähtien Talli Jäsenet | Lähteet | NavigointivalikkoSuomen Hippos – Tähtien Talli

Do these cracks on my tires look bad? The Next CEO of Stack OverflowDry rot tire should I replace?Having to replace tiresFishtailed so easily? Bad tires? ABS?Filling the tires with something other than air, to avoid puncture hassles?Used Michelin tires safe to install?Do these tyre cracks necessitate replacement?Rumbling noise: tires or mechanicalIs it possible to fix noisy feathered tires?Are bad winter tires still better than summer tires in winter?Torque converter failure - Related to replacing only 2 tires?Why use snow tires on all 4 wheels on 2-wheel-drive cars?