<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Lusine Abrahamyan on Medium]]></title>
        <description><![CDATA[Stories by Lusine Abrahamyan on Medium]]></description>
        <link>https://medium.com/@lusinlu?source=rss-b59a3af7e3b7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*E9kdo6BYo7XNeQ6oLf09RQ.png</url>
            <title>Stories by Lusine Abrahamyan on Medium</title>
            <link>https://medium.com/@lusinlu?source=rss-b59a3af7e3b7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 06:36:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@lusinlu/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Is 3D AI on the rise? The Best 3D AI Tools of 2025]]></title>
            <link>https://medium.com/antaeus-ar/is-3d-ai-on-the-rise-best-3d-ai-tools-of-2025-f553bf95f013?source=rss-b59a3af7e3b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/f553bf95f013</guid>
            <category><![CDATA[3d-ai]]></category>
            <category><![CDATA[3d-generative-ai]]></category>
            <category><![CDATA[generative-art]]></category>
            <category><![CDATA[3d]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <dc:creator><![CDATA[Lusine Abrahamyan]]></dc:creator>
            <pubDate>Wed, 12 Mar 2025 12:06:52 GMT</pubDate>
            <atom:updated>2025-03-21T09:18:16.294Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SSMXfDWiBGfKL4actvJ3sQ.png" /><figcaption>xImage Source: BeViAI 3D.</figcaption></figure><p>Over the past five years, <strong>Google Trends</strong> data reveals a staggering <strong>300% surge</strong> in global searches for “<strong>3D AI</strong>,” reflecting a booming curiosity and demand for tools that blend artificial intelligence with 3D design.</p><p>The momentum isn’t slowing down: in 2024 alone, <strong>50+ new 3D AI tools</strong> launched, with projections suggesting even faster growth by 2025. <br>From automating 3D model creation to democratizing game development and e-commerce, 3D AI is reshaping industries — and fast.</p><p>Below, we spotlight the <strong>top tools</strong> leading this revolution.</p><h3><strong>TOP 4 TOOLS FOR 3D GENERATION</strong></h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FWxRj47HT8J4%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DWxRj47HT8J4&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FWxRj47HT8J4%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/550e5e8951b0ce2263060821a85dd4c0/href">https://medium.com/media/550e5e8951b0ce2263060821a85dd4c0/href</a></iframe><ol><li><a href="https://3d.beviai.com/"><strong>BeviAI 3D (https://3d.beviai.com/)</strong></a><br>The ultimate free tool for creators on a budget, BeViAI 3D generates <strong>full 3D models with geometry and textures</strong> from just <strong>3–5 input images</strong>. It can be used in e-commerce (Shopify integration), game design, and 3D printing workflows. Unlike other tools, it requires no subscriptions or credits, making it a go-to for hobbyists and small businesses.</li><li><strong>Meshy AI</strong><br>Meshy specializes in <strong>text-to-3D and image-to-3D conversion</strong>, using AI to produce game-ready assets in minutes. Its standout feature? <strong>AI-generated PBR textures</strong> that adapt to lighting conditions. Popular among indie game studios, Meshy offers a free tier with limited exports and a premium plan for heavy users.</li><li><strong>Spline</strong><br>Spline combines <strong>AI-powered 3D design with real-time collaboration</strong>, ideal for teams building interactive web experiences. Its AI tools automate animations, physics simulations, and texture mapping, while its browser-based platform removes hardware barriers. A favorite for UI/UX designers and educators, Spline uses a freemium model.</li><li><strong>3D AI Studio</strong><br>Targeting professionals, 3D AI Studio delivers <strong>studio-grade models</strong> optimized for industries like architecture and product design. Its AI trains on user feedback to refine outputs, ensuring precision for CAD workflows and VR environments. No free tier here — plans start at <strong>$99/month</strong>, but enterprises praise its scalability.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jxcwkR1KcyRdQGHukKo_pw.png" /><figcaption>image source: 3D AI Studio</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f553bf95f013" width="1" height="1" alt=""><hr><p><a href="https://medium.com/antaeus-ar/is-3d-ai-on-the-rise-best-3d-ai-tools-of-2025-f553bf95f013">Is 3D AI on the rise? The Best 3D AI Tools of 2025</a> was originally published in <a href="https://medium.com/antaeus-ar">Antaeus AR</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AI for Everyone: Where to Start and How to Use It]]></title>
            <link>https://medium.com/@lusinlu/ai-for-everyone-where-to-start-and-how-to-use-it-6c6fcacfd202?source=rss-b59a3af7e3b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c6fcacfd202</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[genai]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[aiforeveryone]]></category>
            <category><![CDATA[ai-for-business]]></category>
            <dc:creator><![CDATA[Lusine Abrahamyan]]></dc:creator>
            <pubDate>Wed, 26 Feb 2025 08:17:19 GMT</pubDate>
            <atom:updated>2025-02-26T08:17:19.966Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ng2-bh7NV1uxk47O" /><figcaption>Photo by <a href="https://unsplash.com/@christianlue?utm_source=medium&amp;utm_medium=referral">Christian Lue</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Hey there! I’m Lusine, and I’ve been working in AI and Computer Vision for over 8 years — both in research and industry. I’ve seen AI go from something only experts cared about to something that affects everyone, from social media feeds to online shopping.</p><p>Nowadays, understanding AI isn’t just for tech people. You don’t need to become an AI engineer, but knowing the basics can help you make better decisions, whether you’re a student, entrepreneur, or just curious. So, <strong>I’ve put together a list of great (and free!) resources</strong> based on how deep you want to go.</p><h3>Step 1: AI Basics — Start Here</h3><p>If you’re new to AI and want a simple, beginner-friendly introduction, these resources are a great starting point:</p><p>✅ <a href="https://www.coursera.org/learn/machine-learning-introduction-for-everyone"><strong>Machine Learning for Everyone (Coursera)</strong></a><br>A no-code, beginner course that explains how AI works, where it’s used, and why it’s important. Perfect if you want to get the big picture without diving into math.</p><p>✅ <a href="https://youtu.be/aircAruvnKk?si=6wnTYxvGD_sjIXSU"><strong>How Neural Networks Work (YouTube)</strong></a><br>A fun and simple video explaining what neural networks are (aka how AI “thinks”). No confusing jargon — just clear visuals and explanations.</p><p>✅ <a href="https://www.simplilearn.com/free-ai-program-skillup?utm_source=chatgpt.com"><strong>Free AI Course (Simplilearn)</strong></a><br>A more structured course with quizzes and lessons on AI concepts, machine learning, and deep learning.</p><p>✅ <a href="https://profound.academy/python-introduction"><strong>Python for Beginners (Profound Academy)</strong></a><br>Want to code? Python is the go-to language for AI. This course will help you learn the basics so you can eventually move on to AI projects.</p><h3>Step 2: Going Deeper — For the Curious Minds</h3><p>If you already know the basics and want to go further, check out these:</p><p>📌 <a href="https://arxiv.org/pdf/1706.03762"><strong>The Paper That Changed AI: Transformers (ArXiv)</strong></a><br>This research paper introduced the Transformer model, which powers ChatGPT and most modern AI tools. If you’re serious about understanding AI, this is a must-read (but be warned, it’s technical).</p><p>📌 <a href="https://www.youtube.com/watch?v=wjZofJX0v4M&amp;list=PLZHQObOWTQDNU6R1_67000Dx_ZCJB-3pi&amp;index=6"><strong>LLM Intro (YouTube)</strong></a><br>Ever wondered what’s happening inside an LLM model? This video breaks down the math behind it in an easy-to-follow way.</p><p>📌 <a href="https://learn.deeplearning.ai/courses/diffusion-models/lesson/xb8aa/introduction?courseName=diffusion-models"><strong>Diffusion Models (DeepLearning.AI)</strong></a><br>Diffusion models are used for AI image generation (like MidJourney and DALL·E). This course explains how they work, even if you don’t have a deep math background.</p><p>📌 <a href="https://arxiv.org/pdf/2112.10752"><strong>GLIDE: AI-Powered Image Generation (ArXiv)</strong></a><br>If you’re interested in AI-generated art, this research paper explains how models create realistic images from text descriptions.</p><h3>Skip the Learning — Just Use AI</h3><p>No time (or patience) to learn? That’s okay! If you just want to use AI effectively, these guides will help:</p><p>💡 <a href="https://www.coursera.org/learn/introduction-to-large-language-models/"><strong>Intro to Large Language Models (Coursera)</strong></a><br>This beginner-friendly course explores how you can use prompt tuning to enhance LLM performance. It’s a quick course, approximately one hour long, and requires no prior experience.</p><p>💡 <a href="https://www.youtube.com/redirect?event=video_description&amp;redir_token=QUFFLUhqbG8yc19nLW5CeEdoTE5HQVdCZHNVYnNTa3lqQXxBQ3Jtc0ttaXhzcXE3eFRaM3M5OGkwLWxmR1JOdldHZGRnWGd0ZTNqMDgxcUtKUWhLS0FkaUk0dmtlQjU4Mm1KNGxtaVphYkxHTXhlRnNDQ0E4SFpKemg0MDlEdGxURlpiY2l4YjYyckRPa2ViZ19zSG9KLTdXYw&amp;q=https%3A%2F%2Fwww.cloudskillsboost.google%2Fpaths%2F118&amp;v=0TCYAafJgRE"><strong>Google Cloud AI Training</strong></a><br>A practical guide for business owners and professionals who want to use AI-powered cloud tools without needing to code.</p><p>💡 <a href="https://agentacademy.ai/courses/understanding-agentic-ai/"><strong>Understanding Agentic AI (Agent Academy)</strong></a><br>Learn how AI agents can automate tasks, work on your behalf, and make your life easier — all in a non-technical way.</p><h3>Final Thoughts</h3><p>AI is here to stay, and knowing how it works (even just the basics) can give you an edge. Whether you want to fully understand it or just use it, there’s a learning path for everyone.</p><p>Let me know which resources you found useful — or if you have other favourites, drop them in the comments! 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c6fcacfd202" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hacks for Doing Black Magic of Deep Learning]]></title>
            <link>https://medium.com/data-science/hacks-for-doing-black-magic-of-deep-learning-ab5be5ff5f56?source=rss-b59a3af7e3b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab5be5ff5f56</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Lusine Abrahamyan]]></dc:creator>
            <pubDate>Wed, 16 Oct 2019 14:36:46 GMT</pubDate>
            <atom:updated>2019-10-17T17:37:52.635Z</atom:updated>
            <content:encoded><![CDATA[<h4>machine-learning</h4><h4>Advice, which will help you to master the training of CNN’s</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lTUnlasTVv-8LMg1" /><figcaption>Photo by <a href="https://unsplash.com/@grakozy?utm_source=medium&amp;utm_medium=referral">Greg Rakozy</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Always Overfit</h4><p>Deep neural networks are known as “black boxes”, where it’s hard to do debugging. And after writing the training scripts, you cant be sure that you don’t have any mistakes in the script or foresee whether your model has enough parameters to learn the transformation that you need.</p><p>And that is where the advice about overfiting¹ from Andrej Karpathy is coming.</p><p>At the beginning of the training, before feeding all the data to your network, try to overfit it on the one fixed batch, without any augmentation, and with a very small learning rate. If it will not be overfitted, it means, that, either your model doesn’t have enough learning power for transformation that you need, or you have a bug in your code.</p><p>Only after successful overfitting, it’s reasonable to start training on the whole data.</p><h4>Choose Your Normalization</h4><p>Normalization is a strong technique for overcoming vanishing gradients and train network with higher learning rates, without careful parameter initialization. Originally in the paper of S.Ioffe², it’s proposed to normalize features across the batch and turn activations toward the unit Gaussian distribution, to learn one, universal mean and variance, for the all data distribution(test data included). This approach is valid for all classification tasks when you need to predict one(or several in case of multilabel classification) label for the image. <br>But the picture is different when you are working on image-to-image translation tasks. Here, learning <em>one</em> moving-average and <em>one</em> moving- mean, for the whole dataset may lead to failure. In this case, for each image, as an output of the network, you want to obtain, unique result.<br>And that’s where instance normalization is coming. In contrast, in instance normalization, the statistics are being computed independently for each image in the batch. And this independence is helping to successfully train networks for such tasks as image super-resolution, neural style transfers, image inpainting and much more. <br>So be careful and not use the common practice of transfer learning, with the most famous pre-trained networks as ResNet, MobileNet, Inception, in image transformation tasks.</p><h4>The Bigger (not always) the Better</h4><p>It is known, that in the process of training deep neural networks, the bigger batch size is, the faster convergence will be. But also, it is empirically has been shown, that after a certain point, an increase of the batch size can harm the final performance of the model. In the work, N.S. Keskar et. al.³ stated, that it is connected with the fact that in case of the large batches, training tends to converge to sharp minimizers of the training function, and in case of smaller batches, to flat minimizers. As a result, in the first case, there will be high sensitivity from the training function, and little change in data distribution will harm the performance on the test stage.</p><figure><img alt="A Conceptual Sketch of Flat and Sharp Minima. The Y-axis indicates value of the loss function and the X-axis the parameters." src="https://cdn-images-1.medium.com/max/652/1*eyQJUhR5R2ZwSizHErb6Bw.png" /><figcaption>A Conceptual Sketch of Flat and Sharp Minima. The Y-axis indicates the value of the loss function and the X-axis the parameters.</figcaption></figure><p>But further P. Goyal et. al.⁴ in the paper “Accurate, Large Minibatch SGD: Training ImageNet in 1 Hour”, showed that it is possible to train ImageNet with batch size up to 8K, without degradation in performance. As the authors state, <em>optimization difficulty</em> is the main issue with large minibatches, rather than poor generalization (at least on ImageNet). The authors proposed a linear scaling rule for the learning rate, depending on batch size. The rule is following</p><blockquote>when the minibatch size is multiplied by k, multiply the learning rate by k.</blockquote><figure><img alt="ImageNet top-1 validation error vs. minibatch size." src="https://cdn-images-1.medium.com/max/504/1*DVrRMi9pUy1YoXdGHfcIyw.png" /><figcaption>ImageNet top-1 validation error vs. minibatch size.</figcaption></figure><p>Small batch size also can be considered as the form of regularization, because in this case, you will have noisy updates, which can help to avoid fast convergence to a local minimum and improve generalization.</p><h4>Depthwise Separable Convolution is not Always Your Savior</h4><p>In recent years, with the increase of performance, the number of parameters in the neural networks increased drastically, and the design of the efficient and less costly neural networks turn out to be an issue of the day. <br>One of the solutions, proposed by Google as a part of the Tensorflow⁵ framework, is a depthwise separable convolution, which is a modification of the conventional convolutional layer, where you need fewer parameters.</p><p>Let us suppose, we have a layer with</p><p><em>fi -</em>input filters</p><p><em>fo</em> -output filters</p><p><em>kh</em> -height of the kernel</p><p><em>kw</em> -width of the kernel</p><p>In the case of the convolution, the number of parameters in the layer will be</p><blockquote>N = kh * kw * fi * fo</blockquote><p>We are convolving each input filter by the number of times of output filters and then summing them up.</p><p>And in case of depthwise separable convolution, it will be</p><blockquote>N = kh * kw * fi + 1 * 1 * fo</blockquote><p>We are convolving each input filter one time, with the kernel <em>(kh, kw)</em>, and then, convolving these intermediate filters with the kernel <em>(1, 1),</em> by the number of times of output filters.</p><p>Now, let’s have a look at two examples.</p><h4>Example 1</h4><p>Suppose we have following values for the layer</p><p><em>fi = 128</em></p><p><em>fo = 256</em></p><p><em>kh = 3</em></p><p><em>kw = 3</em></p><p>Number of parameters in the convolutional layer will be</p><p><em>3 * 3 * 128 * 256 = 294.912</em></p><p>Number of parameters in depthwise separable convolution will be</p><p><em>3 * 3 * 128 + 1 * 1 * 256 = 99.456</em></p><p>Advantage in case of the depthwise separable convolution is obvious!!!</p><h4>Example 2</h4><p>Now let’s suppose that we have other values for the layer</p><p><em>fi = 128</em></p><p><em>fo = 256</em></p><p><em>kh = 1</em></p><p><em>kw = 1</em></p><p>Number of parameters in the convolutional layer will be</p><p><em>1 * 1* 128 * 256 = 32.768</em></p><p>Number of parameters in depthwise separable convolution will be</p><p><em>1 * 1* 128 + 1 * 1 * 256 = 32.896</em></p><p>So, as we can see, in the second case, instead of having a reduction, we increased the number of parameters.</p><h3>References</h3><p>[1] Andrej Karpathy blog, <a href="http://karpathy.github.io/2019/04/25/recipe/">http://karpathy.github.io/2019/04/25/recipe/</a></p><p>[2]S.Ioffe, C. Szegedy <a href="https://arxiv.org/pdf/1502.03167.pdf">Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift</a>, 2015, Proceedings of The 32nd International Conference on Machine Learning,</p><p>[3]N. S. Keskar, D. Mudigere, J. Nocedal, M. Smelyanskiy, and P. T. P. Tang, <a href="https://arxiv.org/pdf/1609.04836.pdf">On Large-Batch Training for Deep Learning: Generalization Gap and Sharp Minima</a>, 2017, ICLR</p><p>[4]P. Goyal, P. Dollar, R. Girshick, P. Noordhuis, L. Wesolowski, A. Kyrola, A. Tulloch, Y. Jia, K. He.,<a href="https://arxiv.org/pdf/1706.02677.pdf"> Accurate, Large Minibatch SGD: Training ImageNet in 1 Hour</a>, 2017, arXiv:1706.02677</p><p>[5] <a href="https://www.tensorflow.org/">Tensorflow’s official website</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab5be5ff5f56" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/hacks-for-doing-black-magic-of-deep-learning-ab5be5ff5f56">Hacks for Doing Black Magic of Deep Learning</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Guide on Quantizing and Converting Model to Tensorflow Lite]]></title>
            <link>https://medium.com/analytics-vidhya/mobile-inference-b943dc99e29b?source=rss-b59a3af7e3b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/b943dc99e29b</guid>
            <category><![CDATA[tensorflow]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[tensorflow-lite]]></category>
            <dc:creator><![CDATA[Lusine Abrahamyan]]></dc:creator>
            <pubDate>Sat, 31 Aug 2019 17:33:55 GMT</pubDate>
            <atom:updated>2020-01-30T09:20:17.261Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*BUr03Y0PJrlB-ocEDH-ZIQ.jpeg" /></figure><p>In recent years, in deep learning, with the increase of the performance of the models, there is also a huge increase in the amount of the parameters in the model. For example — Inceptionv3 contains about 23M parameters. All this is making impossible to run them on mobile devices.</p><p>Fortunately, for doing so, there are several options — design lightweight architecture, or save the weights of the trained model in the low precision types like float16, uint8…</p><p>Further, we will concentrate on the second option of quantizing and converting models with the help of Tensorflow.</p><h3>Overview</h3><p>Within the Tensorflow Lite¹, there are several options for obtaining a mobile-optimized model</p><ol><li>Convert from Tensorflow to Tensorflow Lite without any modifications in the weights and activation types.</li><li>Convert model and simultaneously quantize the weights(with default ranges in quantization algorithm)</li><li>Do quantization aware training, which will learn min and max ranges of the weights per layer, and only after converting it to tflite.</li></ol><h3>Simple Convert</h3><p>In this case, your model will be just converted to tflite without any optimization, and you will be able to use it on mobile, to do inference within the Tensorflow Lite framework.</p><p>Here is an example of converting from the Keras model.</p><pre>converter = tf.lite.TFLiteConverter.from_keras_model_file(&#39;model_keras.h5&#39;)<br>tflite_model = converter.convert()<br>tflite_model_quant_file = <strong>&quot;./test.tflite&quot;<br></strong>tflite_model_quant_file.write_bytes(tflite_model)</pre><h3>Convert + Post Training Quantization</h3><p>In this case, you have an option to convert weights to uint8, which will reduce size of the model, but be aware, that it can increase latency of the model, because in the inference time, before executing operation on the input, weights of the layer will be converted back to float32, and in summation, this operations can take significant amount of time — depend on your architecture. From the official documentation of the Tensorflow², formula of quantization is</p><pre>out[i] = (in[i] - min_range) * range(T) / (max_range - min_range)<br>if T == qint8: out[i] -= (range(T) + 1) / 2.0<br>where <br>range(T) = numeric_limits&lt;T&gt;::max() - numeric_limits&lt;T&gt;::min()</pre><p>Also, there could be performance degradation, because max_range and min_range have default values for all the layers.</p><p>Here is a example of converting the model, with post-train-quantization.</p><pre>converter = tf.lite.TFLiteConverter.from_keras_model_file(&#39;model_keras.h5&#39;)<br>converter.optimizations = [tf.lite.Optimize.DEFAULT]<br>tflite_model = converter.convert()<br>tflite_model_quant_file = <strong>&quot;./test.tflite&quot;<br></strong>tflite_model_quant_file.write_bytes(tflite_model)</pre><h3>Quantization Aware Training</h3><p>To address problem raised bellow, about default ranges of min/max values, Teansorflow has created the flow where, in the process of constructing the graph you can insert fake nodes in each layer, to simulate the effect of quantization in the forward and backward passes and to learn ranges in the training process, for each layer separately.</p><p>All is needed for enabling this option in training, is add build-in method, of converting graph, to include fake nodes, after constructing the main model</p><pre><strong>with </strong>tf.variable_scope(<strong>&#39;quantize&#39;</strong>):<br>    output= model(x=image_tf, is_training=<strong>True</strong>, keep_prob=keep_prob_tf)<br>tf.contrib.quantize.create_training_graph(quant_delay=0)</pre><p>After the training, in the stage of exporting the graph, you will need to call a method to convert the graph to the corresponding inference only version, where already trained fake nodes will be treated as min/max ranges for each layer.</p><pre><strong>with </strong>tf.variable_scope(<strong>&#39;quantize&#39;</strong>):<br>    output = model(x=input, is_training=<strong>False</strong>, keep_prob=1.)</pre><pre>g = tf.get_default_graph()<br>tf.contrib.quantize.create_eval_graph(input_graph=g)</pre><p>And after, you can convert the model, with the help of the TensorflowLite converter, specifying options of inference and inference input types as uint8.</p><pre>converter = lite.TFLiteConverter.from_session(session, [input], [output])<br>converter.inference_type = tf.uint8<br>converter.inference_input_type = tf.uint8<br>input_arrays = converter.get_input_arrays()<br>converter.quantized_input_stats = {input_arrays[0] : (0., 1.)}</pre><pre>flatbuffer = converter.convert()</pre><pre><strong>with </strong>open(<strong>&#39;test.tflite&#39;</strong>, <strong>&#39;wb&#39;</strong>) <strong>as </strong>outfile:<br>    outfile.write(flatbuffer)</pre><h3>Pitfalls in the Quantization Aware Training (for Tensorflow 1.14)</h3><ol><li>There is no support for fused batch norm, which is a default option for tf.layers.batch_normalization.</li><li>Currently, there is a discrepancy in the variable scopes in the train and eval graph, so there is a need to manually add variable scope to the graph.</li></ol><pre># the training stage<br><strong>with </strong>tf.variable_scope(<strong>&#39;quantize&#39;</strong>):<br>    output= model(x=image_tf, is_training=<strong>True</strong>, keep_prob=keep_prob_tf)<br>tf.contrib.quantize.create_training_graph(quant_delay=0)</pre><pre># exporting stage<br><strong>with </strong>tf.variable_scope(<strong>&#39;quantize&#39;</strong>):<br>    output = model(x=input, is_training=<strong>False</strong>, keep_prob=1.)<br>g = tf.get_default_graph()<br>tf.contrib.quantize.create_eval_graph(input_graph=g)</pre><p>3. Because the TensorflowLite converter is only taking into account nodes between input and output nodes strictly, the fake nodes of the last layer, which in the graph are coming only after actual node, are being ignored, and it’s causing tflite converter error. There can be a workaround in the form of adding some useless op, which will not harm the result of the graph, e.g.</p><pre><strong>with </strong>tf.variable_scope(<strong>&#39;quantize&#39;</strong>):<br>    output = model(x=input, is_training=<strong>False</strong>, keep_prob=1.)<br>    output = tf.maximum(output, -1e27)</pre><p><a href="https://github.com/lusinlu/tensorflow_lite_guide">The source code of the examples</a></p><h3>References</h3><p>[1] Official documentation of Tensorflow Lite, <a href="https://www.tensorflow.org/lite">https://www.tensorflow.org/lite</a></p><p>[2] Implementation of the Tensorflow quantization, <a href="https://www.tensorflow.org/api_docs/python/tf/quantization/quantize">https://www.tensorflow.org/api_docs/python/tf/quantization/quantize</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b943dc99e29b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/mobile-inference-b943dc99e29b">Guide on Quantizing and Converting Model to Tensorflow Lite</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>