<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/deep-learning-for-brand-logo-detection-part-ii/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://flovv.github.io/Logo_detection_deep_learning_part2/"> Florian Teschner</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>A month ago, I started playing with the deep learning framework <a rel="nofollow" href="https://rstudio.github.io/keras/" target="_blank">Keras for R</a>. As a use-case I picked logo detection in images. While the training of a net worked out fine, the results were mediocre.<br>
(Check out the <a rel="nofollow" href="http://flovv.github.io/Logo_detection_deep_learning/" target="_blank">full post</a> to for details on the model and the setup.)<br>
Here is the recap of the outcome; training the model on the <a rel="nofollow" href="http://image.ntua.gr/iva/datasets/flickr_logos" target="_blank">Flickr27-dataset</a>, with only 270 images of 27 classes, the validation accuracy came out at 15%.</p>
<p><img alt="plot last session" src="https://i1.wp.com/flovv.github.io/figures/post21/TrainingHistory.png?w=456" data-recalc-dims="1"></p>
<p>However, there are at least two points to remember; the dataset is really small -especially to train a deep neural network, and some brands are hard to recognize, even for the human eye.</p>
<p>In order to improve on the use-case (logo detection in advertisements), I downloaded 20 additional images for each brand logo from google image search using a <a rel="nofollow" href="http://flovv.github.io/scrape_images_google/" target="_blank">rough script</a>.</p>
<p>Equipped with the enhanced dataset, I trained the model again, using the same model setup as in the last post but with slightly different parameters.</p>
<p><img alt="plot of chunk unnamed-chunk-8" src="https://i0.wp.com/flovv.github.io/figures/post22/unnamed-chunk-8-1.png?w=456" data-recalc-dims="1"></p>
<p>The effect is visible; the validation accuracy jumps up to 44%.<br>
One thing that I also improved on is a more experimental approach to parameter variation.</p>
<p>In the grid search approach, I varied the learning (lr), image size and input filter parameters.<br>
Plotting the validation accuracy over the 200 epochs, we see a high variation in the achieved accuracy. Some parameters combinations do not lead the model to learn information about images, while other variations quite quickly converge to good results.</p>
<p><img alt="plot of chunk unnamed-chunk-9" src="https://i2.wp.com/flovv.github.io/figures/post22/unnamed-chunk-9-1.png?w=456" data-recalc-dims="1"></p>
<p>What I still find confusing is that the parameters seem to have an interaction effect on model convergence and performance.<br>
While the learning rate of 0.001 works well with 32 pixel image sizes, it completely fails in the case of 64 pixel images. The even lower learning rate of 1e-04 (0.0001) at least moves constantly upwards in all cases but much more so in the case of 64 pixel images.</p>
<p>In order to improve on the existing model, I plan to further augment the training dataset, and finally use a pre-trained image model.</p>
<p>For reference, this is the setup from the previous post:</p>
<p></p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://flovv.github.io/Logo_detection_deep_learning_part2/"> Florian Teschner</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/HEZbYm2Kg4E" height="1"></a></div>