<?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 Vatsal Sodha on Medium]]></title>
        <description><![CDATA[Stories by Vatsal Sodha on Medium]]></description>
        <link>https://medium.com/@vatsalsodha?source=rss-835e06698e34------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*SLfIYIxehtrJCTZ7w12vXw.jpeg</url>
            <title>Stories by Vatsal Sodha on Medium</title>
            <link>https://medium.com/@vatsalsodha?source=rss-835e06698e34------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 20:58:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vatsalsodha/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[3 steps to update parameters of Faster R-CNN/SSD models in TensorFlow Object Detection API]]></title>
            <link>https://medium.com/data-science/3-steps-to-update-parameters-of-faster-r-cnn-ssd-models-in-tensorflow-object-detection-api-7eddb11273ed?source=rss-835e06698e34------2</link>
            <guid isPermaLink="false">https://medium.com/p/7eddb11273ed</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[object-detection]]></category>
            <category><![CDATA[tensorflow]]></category>
            <dc:creator><![CDATA[Vatsal Sodha]]></dc:creator>
            <pubDate>Mon, 30 Jul 2018 13:06:47 GMT</pubDate>
            <atom:updated>2020-12-14T18:37:36.055Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/603/1*DeEwIMTx-aWxLBxb5uVrXg.jpeg" /></figure><p>I wrote an article on configuring TensorFlow Object Detection API. Kindly, refer to that story <a href="https://becominghuman.ai/tensorflow-object-detection-api-tutorial-training-and-evaluating-custom-object-detector-ed2594afcf73">here</a> to configure the API. That story is a prerequisite for this article.</p><p>In this story, I will discuss how to change the configuration of pre-trained model. The aim of this article is that you can configure <a href="https://github.com/tensorflow/models">TensorFlow/models</a> based on your application and API will no longer be a black box!</p><p>The article’s overview:</p><ul><li>Understanding of protocol buffers and proto files.</li><li>Using knowledge of proto files, how can we understand the <a href="https://github.com/tensorflow/models/tree/master/research/object_detection/samples/configs">config files</a> of the model</li><li>3 steps to follow to update the parameters of the model</li><li>Miscellaneous examples:</li></ul><ol><li>Changing the weight initializer</li><li>Changing the weight optimizer</li><li>Evaluating the pre-trained model.</li></ol><h4>Protocol Buffers</h4><p>To modify the model, we need to understand it’s inner mechanisms. <a href="https://github.com/tensorflow/models/">TensorFlow Object Detection API</a> uses <a href="https://developers.google.com/protocol-buffers/">Protocol Buffers</a>, which is language-independent, platform-independent, and extensible mechanism for serializing structured data. It’s like XML at a smaller scale, but faster and simpler. API uses the <em>proto2</em> version of the protocol buffers language. I will try to explain this language which is required to update the pre-configured model. For more details on protocol buffers language, refer to this <a href="https://developers.google.com/protocol-buffers/docs/proto">documentation</a> and <a href="https://developers.google.com/protocol-buffers/docs/pythontutorial">Python tutorial</a>.</p><p>Working of protocol buffers can be explained in 3 steps as below:</p><ul><li>Define a message format in .proto file. This file acts like a blueprint of all messages, which shows what all parameters are accepted by the message, what should be the data type of the parameter, whether the parameter is required or optional, what is the tag number of the parameter, what is the default value of the parameter etc. API’s protos files can be found <a href="https://github.com/tensorflow/models/tree/master/research/object_detection/protos">here</a>. For the purpose of understanding, I am using <a href="https://github.com/tensorflow/models/blob/master/research/object_detection/protos/grid_anchor_generator.proto">grid_anchor_generator.proto</a> file.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d0bd7cbb20ab11b52f8b15a190cb3aff/href">https://medium.com/media/d0bd7cbb20ab11b52f8b15a190cb3aff/href</a></iframe><p>It is clear from the lines 30–33 that the parameters scales and aspect_ratios are mandatory for message GridAnchorGenerator, while rest of the parameters are optional if not passed, it will take default values.</p><ul><li>After defining a message format, we need to compile the protocol buffer. This compiler will generate the classes file from .proto file. During installation of API we had run the below command which will compile the protocol buffers:</li></ul><pre># From tensorflow/models/research/<br>protoc object_detection/protos/*.proto --python_out=.</pre><ul><li>After defining and compiling the protocol buffer, we need to use Python protocol buffer API to write and read messages. In our case, we can consider the config file as protocol buffer API, which can write and read messages, ignoring the inner mechanisms of TensorFlow API. In other words, we can update the parameters of the pre-trained model by appropriately changing the config file.</li></ul><h4>Understanding the config file</h4><p>It is clear that config files can help us to change the parameters of the model according to our needs. Next question that pops up is how can we change the parameters of the model? This section and next section answers this question where knowledge of proto files will be handy. For demonstration purpose I am using <a href="https://github.com/tensorflow/models/blob/master/research/object_detection/samples/configs/faster_rcnn_resnet50_pets.config">faster_rcnn_resnet50_pets.config</a> file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4c8d7144f677b43bafd62d1fd2f3c3d7/href">https://medium.com/media/4c8d7144f677b43bafd62d1fd2f3c3d7/href</a></iframe><p>Lines 7–10 implies that num_classes is one of the parameters of faster_rcnn message, which in turn is the parameter of the message model. Similarly, optimizer is the child message of parent train_config message, while batch_size is another parameter of train_config message. We can verify this by checking out the corresponding <a href="https://github.com/tensorflow/models/tree/master/research/object_detection/protos">protos</a> file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/220225d5079ed7ffbc36b9fa398c28d3/href">https://medium.com/media/220225d5079ed7ffbc36b9fa398c28d3/href</a></iframe><p>It is clear from lines 20 and 26 that num_classes is one of the optional parameter of the message faster_rcnn. I hope discussion till now helps to understand the organization of config files. Now, it is the time to correctly update one of the parameters of the model.</p><blockquote>Step 1: Decide the parameter to be updated</blockquote><p>Let’s say we need to update image_resizer parameter mentioned in line 10 of <a href="https://github.com/tensorflow/models/blob/master/research/object_detection/samples/configs/faster_rcnn_resnet50_pets.config">faster_rcnn_resnet50_pets.config</a> file.</p><blockquote>Step 2: Search for the given parameter in the repository</blockquote><p>The goal is to locate the proto file of the parameter. For that we need to search in the repository.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*usr5KDQ7qXKKWjxYWZ1NBQ.png" /><figcaption>Search in the repository</figcaption></figure><p>We need to search the following code:</p><pre>parameter_name path:research/object_detection/protos</pre><pre>#in our case parameter_name=&quot;image_resizer&quot; thus,<br>image_resizer path:research/object_detection/protos</pre><p>Here path:research/object_detection/protos confines the search domain. More information on how to search on GitHub can be found <a href="https://help.github.com/articles/searching-code/">here</a>. The output on searching image_resizer path:research/object_detection/protos is shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ayYWVEZg5onKivcFv2u1jw.png" /><figcaption>Search result of image_resizer path:research/object_detection/proros</figcaption></figure><p>It is clear from the output that to update the image_resizer parameter we need to analyse the image_resizer.proto file.</p><blockquote>Step 3: Analyze the proto file</blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/eaf04c3666fb68c84dc1893148909e1a/href">https://medium.com/media/eaf04c3666fb68c84dc1893148909e1a/href</a></iframe><p>It is clear from lines 8–10 that we can resize the image using keep_aspect_ratio_resizer orfixed_shape_resizer. On analyzing lines 23–44, we can observe that message keep_aspect_ratio_resizer have parameters: min_dimension, max_dimension, resize_method, pad_to_max_dimension, convert_to_grayscale,and per_channel_pad_value. Moreover, fixed_shape_resizer have parameters: height, width, resize_method,and convert_to_grayscale. All the parameters have their datatypes mentioned in the proto file. So, to change the image_resizer type we can change the following lines in the config file.</p><pre>#before<br>image_resizer {<br>keep_aspect_ratio_resizer {<br>min_dimension: 600 <br>max_dimension: 1024<br>    }<br>}</pre><pre>#after<br>image_resizer {<br>fixed_shape_resizer {<br>height: 600<br>width: 500<br>resize_method: AREA<br>  }<br>}</pre><p>The above code will resize the image to 500 * 600 using AREA resize method. The various resize methods available in TensorFlow can be found <a href="https://www.tensorflow.org/api_docs/python/tf/image/ResizeMethod">here</a>.</p><blockquote>Miscellaneous Examples</blockquote><p>We can update/add any parameter using steps discussed in the above section. I will demonstrate some of the examples here which are frequently used but the steps, discussed above can be helpful to update/add any parameters of the model.</p><h4>Changing the weight intializer</h4><ul><li>Decided to change the parameter initializer on line 35 of the <a href="https://github.com/tensorflow/models/blob/master/research/object_detection/samples/configs/faster_rcnn_resnet50_pets.config">faster_rcnn_resnet50_pets.config</a> file.</li><li>Search for the initializer path:research/object_detection/protos in the repository. From the search result, it is clear that we need to analyze the hyperparams.proto file.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pCgr1NLTOyaK2HUS4Bu4_A.png" /><figcaption>Search result of initializer path:research/object_detection/proros</figcaption></figure><ul><li>Line 68–74 in the <a href="https://github.com/tensorflow/models/blob/b9ca525f88cd942882ca541ec5ac9d27bb87a24f/research/object_detection/protos/hyperparams.proto">hyperparams.proto</a> file, explains initializer configuration.</li></ul><pre>message Initializer {<br>  oneof initializer_oneof {<br>    TruncatedNormalInitializer truncated_normal_initializer = 1;<br>    VarianceScalingInitializer variance_scaling_initializer = 2;<br>    RandomNormalInitializer random_normal_initializer = 3;<br>  }<br>}</pre><p>We can use random_normal_intializer instead of truncated_normal_initializer, for that we need to analyze line 99–102 in the <a href="https://github.com/tensorflow/models/blob/b9ca525f88cd942882ca541ec5ac9d27bb87a24f/research/object_detection/protos/hyperparams.proto">hyperparams.proto</a> file.</p><pre>message RandomNormalInitializer {<br>  optional float mean = 1 [default = 0.0];<br>  optional float stddev = 2 [default = 1.0];<br>}</pre><p>It is clear that random_normal_intializer have 2 parameters mean and stddev. We can change the following lines in the config file to use random_normal_intializer.</p><pre>#before<br>initializer {<br>    truncated_normal_initializer {<br>        stddev: 0.01<br>       }<br>}</pre><pre>#after<br>initializer {<br>    random_normal_intializer{<br>       mean: 1 <br>       stddev: 0.5<br>       }<br>}</pre><h4>Changing the weight optimizer</h4><ul><li>Decided to change the parameter momentum_optimizer of parent message optimizer on line 87 of the <a href="https://github.com/tensorflow/models/blob/master/research/object_detection/samples/configs/faster_rcnn_resnet50_pets.config">faster_rcnn_resnet50_pets.config</a> file.</li><li>Search for the optimizer path:research/object_detection/protos in the repository. From the search result, it is clear that we need to analyze the optimizer.proto file.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DI3-DOCW1qcyhvqN59cAOw.png" /><figcaption>Search result of optimizer path:research/object_detection/proros</figcaption></figure><ul><li>Lines 9–14 in <a href="https://github.com/tensorflow/models/blob/7025590841588e82f371ef0fef7dd77a8a71efb8/research/object_detection/protos/optimizer.proto">optimizer.proto</a> file, expain optimizer configuration.</li></ul><pre>message Optimizer {<br>  oneof optimizer {<br>    RMSPropOptimizer rms_prop_optimizer = 1;<br>    MomentumOptimizer momentum_optimizer = 2;<br>    AdamOptimizer adam_optimizer = 3;<br>  }</pre><p>It is clear that instead of momentum_optimizer we can use adam_optimizer which has been proved to be good optimizer. To do that we need following changes in the f<a href="https://github.com/tensorflow/models/blob/master/research/object_detection/samples/configs/faster_rcnn_resnet50_pets.config">aster_rcnn_resnet50_pets.config</a> file.</p><pre>#before<br>optimizer {  <br>  momentum_optimizer: {<br>      learning_rate: {<br>           manual_step_learning_rate {<br>          initial_learning_rate: 0.0003<br>          schedule {<br>            step: 900000<br>            learning_rate: .00003<br>          }<br>          schedule {<br>            step: 1200000<br>            learning_rate: .000003<br>          }<br>        }<br>      }<br>      momentum_optimizer_value: 0.9<br>    }</pre><pre>#after<br>optimizer {<br>  adam_optimizer: {<br>      learning_rate: {<br>       manual_step_learning_rate {<br>          initial_learning_rate: 0.0003<br>          schedule {<br>            step: 900000<br>            learning_rate: .00003<br>          }<br>          schedule {<br>            step: 1200000<br>            learning_rate: .000003<br>          }<br>        }<br>      }<br>    }</pre><h4>Evaluating pre-trained model</h4><p>Eval waits for 300 seconds to check whether training model is updated or not! If your GPU is good, you can train and eval both simultaneously! Generally, resources will be exhausted. To overcome this, we can train the model first, save it in the directory, and evaluate the model later. To evaluate later, we need following changes in the config file:</p><pre>#Before<br>eval_config: {<br>  num_examples: 2000<br>  # Note: The below line limits the evaluation process to 10 evaluations.<br>  # Remove the below line to evaluate indefinitely.<br>  max_evals: 10<br>}</pre><pre>#after<br>eval_config: {<br>num_examples: 10<br>num_visualizations: 10<br>eval_interval_secs: 0<br>}</pre><p>num_visualizations should be equal to number of to be evaluated! Higher the number of visualizations, more time it will take to evaluate. If your GPU is capable enough to train and eval simultaneously, you can keep eval_interval_secs: 300. This parameter is to decide how often to run evaluation. I followed 3 steps discussed above to come to this conclusion.</p><p>In a nutshell, the knowledge of protocol buffers helped us to understand that parameters to the model are passed in the form of messages and to update the parameter we can refer .proto file. 3 simple steps were discussed to find the correct .proto file for updating the parameter. Recently, I came across <a href="https://neptune.ai/blog/how-to-train-your-own-object-detector-using-tensorflow-object-detection-api">this article </a>on <a href="https://neptune.ai/">neptune.ai</a> which can be useful for further reference.</p><p>Kindly mention any parameter you want to update/add in the config file in the comments.</p><p>I hope this article helps.</p><p>-SodhA</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7eddb11273ed" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/3-steps-to-update-parameters-of-faster-r-cnn-ssd-models-in-tensorflow-object-detection-api-7eddb11273ed">3 steps to update parameters of Faster R-CNN/SSD models in TensorFlow Object Detection API</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[TensorFlow Object Detection API tutorial — Training and Evaluating Custom Object Detector]]></title>
            <link>https://becominghuman.ai/tensorflow-object-detection-api-tutorial-training-and-evaluating-custom-object-detector-ed2594afcf73?source=rss-835e06698e34------2</link>
            <guid isPermaLink="false">https://medium.com/p/ed2594afcf73</guid>
            <category><![CDATA[tensorflow]]></category>
            <category><![CDATA[object-detection]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Vatsal Sodha]]></dc:creator>
            <pubDate>Mon, 26 Mar 2018 16:15:11 GMT</pubDate>
            <atom:updated>2018-08-01T00:33:33.618Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/603/1*MTcH1FEziN1mnMUQfn7PUw.jpeg" /><figcaption>Sample output of object detector.</figcaption></figure><p>We all are driving cars, it’s easy right? But what if someone asks you to fly an airplane, what you will do? Yes, you guessed right you will look at the instruction manual. Similarly, consider this tutorial as a manual to configure the complex API and I hope this tutorial helps you to take a safe flight.</p><p>First thing first, clone the <a href="https://github.com/tensorflow/models">TensorFlow object detection repository,</a> and I hope you have <a href="https://www.tensorflow.org/install/">installed TensorFlow</a>.</p><pre><em>git clone </em><a href="https://github.com/tensorflow/models.git"><em>https://github.com/tensorflow/models.git</em></a></pre><p>In the classical machine learning, what we do is with the use of .csv file we will train and test the model. But here, what we have to do at rudimentary level is shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lwWSdaGoAfdK34GSyYGYNA.jpeg" /><figcaption>Basic flow diagram.</figcaption></figure><figure><a href="http://bit.ly/BusinessOfBots"><img alt="" src="https://cdn-images-1.medium.com/max/960/1*LeQDzsUCGnHVAO8LohatOg.jpeg" /></a></figure><p>Before proceeding further, I want to discuss directory structure that I will use throughout the tutorial.</p><ul><li>data/ — Will have records and csv files.</li><li>images/ — This directory will contain our dataset.</li><li>training/ — In this directory we will save our trained model.</li><li>eval/ — Will save results of evaluation on trained model.</li></ul><h3>Trending AI Articles:</h3><blockquote><a href="https://becominghuman.ai/digital-processes-inspiring-analog-paintings-a358eb7801a0">1. How I used machine learning as inspiration for physical paintings</a></blockquote><blockquote><a href="https://becominghuman.ai/ms-or-startup-job-which-way-to-go-to-build-a-career-in-deep-learning-2d62a5b10f9e">2. MS or Startup Job — Which way to go to build a career in Deep Learning?</a></blockquote><blockquote><a href="https://becominghuman.ai/top-100-medium-com-c2695ab3270c">3. TOP 100 medium articles related with Artificial Intelligence</a></blockquote><blockquote><strong>Step 1: Generating CSV files from Images</strong></blockquote><p>This step is pretty simple, I won’t dive much deeper but I will mention here some of the good sources. The goal is to label the image and generate train.csv and test.csv files.</p><ol><li>Label the <a href="https://github.com/tzutalin/labelImg">image using lablelImg</a>. The detailed explanation can be <a href="https://www.youtube.com/watch?v=K_mFnvzyLvc&amp;list=PLQVvvaa0QuDcNK5GeCQnxYnSSaar2tpku&amp;index=3">found here</a>.</li><li>We need to convert XML into csv files which is <a href="https://www.youtube.com/watch?v=kq2Gjv_pPe8&amp;index=4&amp;list=PLQVvvaa0QuDcNK5GeCQnxYnSSaar2tpku">demonstrated here</a></li></ol><p>The reason being I am not mentioning in detail is there are various ways to generate the csv files from images depending on type of data sets we are dealing with.</p><p>In my project, I want to detect Lung nodules using <a href="https://luna16.grand-challenge.org/data/">LUNA dataset</a>, we already had co-ordinates of nodules to be detected, so for us it is pretty simple to make csv files. To detect nodules we are using 6 co-ordinates as show below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a5fd5efaf3494b3607f3b599a3caf202/href">https://medium.com/media/a5fd5efaf3494b3607f3b599a3caf202/href</a></iframe><p>Instead of class nodules, your file will have different classes name, else will remain the same. Once, our labelled image data is turned into number we are good to go for generating TFRecords</p><blockquote><strong>Step 2: Generating TFRecords</strong></blockquote><p>TensorFlow object detection API doesn’t take csv files as an input, but it needs record files to train the model. I have <a href="https://github.com/datitran/raccoon_dataset/blob/master/generate_tfrecord.py">used this file to generate tfRecords.</a></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c9221b82ec8f12abf4aec291ee95dd9d/href">https://medium.com/media/c9221b82ec8f12abf4aec291ee95dd9d/href</a></iframe><p>Download this file, and we need to just make a single change, on line 31 we will change our label instead of “racoon”. For example, in my case it will be “nodules” . You can add multiple class if you need to detect multiple objects.</p><p><em>Note: Label’s return value should start from 1 not from zero. Let’s say, if you have to detect 3 labels then corresponding return values will be 1,2 and 3</em></p><p>To generate train.record file use the code as shown below:</p><pre>python generate_tfRecord.py --csv_input=data/train.csv  --output_path=data/train.record</pre><p>To generate test.record file use the code as shown below:</p><pre>python generate_tfrecord.py — csv_input=data/test.csv — output_path=data/test.record</pre><blockquote><strong>Step 3: Training the Model</strong></blockquote><p>Once our records files are ready, we are almost ready to train the model.</p><ol><li><a href="https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/detection_model_zoo.md">Decide the pre-trained model to be used</a>. There’s a trade off between detection speed and accuracy, higher the speed lower the accuracy and vice versa. I am using ssd_mobilenet_v1_coco for demonstration purpose.</li><li>After deciding the model to be used <a href="https://github.com/tensorflow/models/tree/master/research/object_detection/samples/configs">download the config file for the same</a> model. In my case, I will download ssd_mobilenet_v1_coco.config.</li><li>Make a new file <em>object-detection.pbtxt </em>which looks like this:</li></ol><pre>item {<br>  id: 1<br>  name: &#39;nodule&#39;<br>}</pre><p>Give class name i.e nodule in my case. If in case you have multiple classes, increase id number starting from 1 and give appropriate class name.</p><p>Now, it’s time to configure the <a href="https://github.com/tensorflow/models/blob/master/research/object_detection/samples/configs/ssd_mobilenet_v1_coco.config">ssd_mobilenet_v1_coco.config</a> file. I am mentioning here the lines to be change in the file.</p><p>Change the number of classes in the file according to our requirement.</p><pre>#before<br>num_classes: 90<br>#After<br>num_classes: 1</pre><p>If your desktop do not have good GPU then you need to decrease the batch_size.</p><pre>batch_size: 24</pre><p>Give path to downloaded model i.e ssd_mobilenet_v1_coco; the model we decided to use in step 1.</p><pre>#before<br>fine_tune_checkpoint: &quot;PATH_TO_BE_CONFIGURED/model.ckpt&quot;<br>#after<br>fine_tune_checkpoint: &quot;ssd_mobilenet_v1_coco/model.ckpt&quot;</pre><p>Need to give path to train.record file.</p><pre>#before</pre><pre>train_input_reader: {  <br>tf_record_input_reader {   <br>input_path: &quot;PATH_TO_BE_CONFIGURED/mscoco_train.record&quot;<br>}<br>label_map_path: &quot;PATH_TO_BE_CONFIGURED/mscoco_label_map.pbtxt&quot;<br>}</pre><pre>#after</pre><pre>train_input_reader: {  <br>tf_record_input_reader {   <br>input_path: &quot;data/train.record&quot;<br>}<br>label_map_path: &quot;data/object-detection.pbtxt&quot;<br>}</pre><p>Need to give path for test.record file</p><pre>#before</pre><pre>eval_input_reader: {  <br>tf_record_input_reader {<br>input_path: &quot;PATH_TO_BE_CONFIGURED/mscoco_val.record&quot; <br> }<br>label_map_path: &quot;PATH_TO_BE_CONFIGURED/mscoco_label_map.pbtxt&quot;  shuffle: false<br>num_readers: 1}</pre><pre>#after</pre><pre>eval_input_reader: {  <br>tf_record_input_reader {<br>input_path: &quot;data/test.record&quot; <br> }<br>label_map_path: &quot;data/object-detection.pbtxt&quot;  <br>shuffle: false<br>num_readers: 1}</pre><p>Now, copy <em>data/</em>, <em>images/</em> directories to <em>models/research/object-detection </em>directory. If it prompts to merge the directory, merge it.</p><p>We have to use train.py residing inside object-detection/ directory.</p><pre>cd models/research/object-detection</pre><p>Make a new directory <em>training/</em> inside <em>object-detection/ directory. </em>The trained model will be saved in <em>training/ </em>Copy the config file ssd_mobilenet_v1_coco.config to <em>training/ directory. </em>You can train the model using this command:</p><pre>python train.py --logtostderr \ <br>       --train_dir=training/ \       <br> --pipeline_config_path=training/ssd_mobilenet_v1_coco.config</pre><p>If everything goes right, you will see the loss at particular step.</p><blockquote><strong>Step 4: Evaluating the model</strong></blockquote><p>The final step is to evaluate the trained model saved in <em>training/ </em>directory. We have to use eval.py file and can evaluate using following command:</p><pre>python eval.py \<br>    --logtostderr \<br>    --pipeline_config_path=training/ssd_mobilenet_v1_coco.config \<br>    --checkpoint_dir=training/ \<br>    --eval_dir=eval/</pre><p>This will save the eval results in <em>eval/ directory. </em>To visualize the results we will use tensor board.</p><pre>#To visualize the eval results<br>tensorboard --logdir=eval/</pre><pre>#TO visualize the training results<br>tensorboard --logdir=training/</pre><p>Open the link in browser and under <em>Images </em>tag you can see the results as demonstrated below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*7yY6KUNRZmbgSyYkohv1Jw.png" /><figcaption>Sample image from visualization of eval/</figcaption></figure><p>That’s all, you have successfully configured the TensorFlow Object Detection API.</p><p>Please mention any errors in the comment section, you encounter while configuring the API, as I had faced many errors while configuring it.</p><p>One of the common error is:</p><pre>No module named deployment on object_detection/train.py</pre><p>The solution is paste this command:</p><pre># From tensorflow/models/research/<br>export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim</pre><p>If you are wondering on how to update the parameters of the Faster-RCNN/SSD models in API, do refer <a href="https://towardsdatascience.com/3-steps-to-update-parameters-of-faster-r-cnn-ssd-models-in-tensorflow-object-detection-api-7eddb11273ed">this story</a>.</p><p>Thank you!</p><ul><li>SodhA</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2F8f5f8b%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2F8f5f8b&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/c43026df6fee7cdb1aab8aaf916125ea/href">https://medium.com/media/c43026df6fee7cdb1aab8aaf916125ea/href</a></iframe><figure><a href="https://becominghuman.ai/artificial-intelligence-communities-c305f28e674c"><img alt="" src="https://cdn-images-1.medium.com/max/255/1*2f7OqE2AJK1KSrhkmD9ZMw.png" /></a></figure><figure><a href="https://upscri.be/8f5f8b"><img alt="" src="https://cdn-images-1.medium.com/max/255/1*v-PpfkSWHbvlWWamSVHHWg.png" /></a></figure><figure><a href="https://becominghuman.ai/write-for-us-48270209de63"><img alt="" src="https://cdn-images-1.medium.com/max/255/1*Wt2auqISiEAOZxJ-I7brDQ.png" /></a></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed2594afcf73" width="1" height="1" alt=""><hr><p><a href="https://becominghuman.ai/tensorflow-object-detection-api-tutorial-training-and-evaluating-custom-object-detector-ed2594afcf73">TensorFlow Object Detection API tutorial — Training and Evaluating Custom Object Detector</a> was originally published in <a href="https://becominghuman.ai/">Becoming Human: Artificial Intelligence Magazine</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dopamine: The Chemistry of Addictions]]></title>
            <link>https://medium.com/@vatsalsodha/dopamine-the-chemistry-of-addictions-dae686ae731d?source=rss-835e06698e34------2</link>
            <guid isPermaLink="false">https://medium.com/p/dae686ae731d</guid>
            <category><![CDATA[life]]></category>
            <category><![CDATA[life-lessons]]></category>
            <category><![CDATA[time-management]]></category>
            <category><![CDATA[addiction]]></category>
            <category><![CDATA[emotions]]></category>
            <dc:creator><![CDATA[Vatsal Sodha]]></dc:creator>
            <pubDate>Fri, 19 May 2017 12:01:49 GMT</pubDate>
            <atom:updated>2017-05-19T13:18:58.504Z</atom:updated>
            <content:encoded><![CDATA[<p>What actually drives us? Why do we do a particular task? The answer to the questions are <strong><em>Emotions ; </em></strong>We can’t imagine the volcano of revenge beneath a suicide bomber. On another side, we experience the purest and the most finest unconditional love from our parents. The burning desire inside a sprinter to reach the finish line first, the energy inside a son to fulfill the only dream of his parent, the frustration of swimmer who fall short by 0.01 second from a gold medal, the greed of business man to have tonnes of money, and many other kinds of emotions which have control on us.</p><p>Do you know what would be going inside Romeo’s brain? Only one thought “Juliet, you <em>make my </em><strong><em>dopamine</em></strong><em> levels go all silly</em>”. So what’s dopamine?</p><p>Dopamine is a neurotransmitter (A brain chemical that communicates information between brain and body) and it looks something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*kGElxAbVpqYzC80bZnwNow.png" /><figcaption>Source: Wikipedia</figcaption></figure><p>In the morning, we have an <em>urge</em> of having a coffee, a kiss of wife before going to office makes him feel<em> at top of the world,</em> a <em>desire </em>to buy stocks on an opening of the stock market and have instant profit. The <em>want </em>to have delicious lunch, a <em>hankering</em> to have evening cigarette and<em> lust </em>to have sex at night. In all above instances, we feel love, lust and desire as <em>dopamine</em> is released. At the rudimentary level, we can say that as dopamine is released by our brain we do have a feeling of pleasure.</p><p>My pleasure centres​ were to play video games, listening to music, sleeping and be active on social media. When I used to sit down for my work, I always ended up playing games which resulted in delaying my schedule. Why is it so? Why my brain is more prone towards pleasure? The answer is… Yes, you guessed right Dopamine. We experience pleasure, due to release of dopamine. On its release, it tells the brain to remember the source of pleasure. In a nutshell, when we feel exciting sensation and dopamine levels are high it’s like someone is telling to our brain “Pay attention to this ecstatic moment. Do not Forget it”.</p><p>When we do any pleasurable activity for the first time, brain notices it and remember it. And in free time again brain reminds us to experience the same pleasure, we had in past. Under the hood, dopamine which was released in past wanted to be released again, we perform that activity again… and again brain remembers it. This cycle continues and that pleasurable activity turns into <strong><em>Addiction</em></strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DuV9tXxOwGDpOt_yZgaxyQ.jpeg" /><figcaption>Addiction Cycle.</figcaption></figure><p>The more number of times we complete the cycle, the more want we have to do it again. The need becomes stronger each time we complete the cycle. As we keep doing it, our brain adds a survival value to that activity. That means it tops the list of <em>Roti, kapda and makan (food, cloth and shelter). </em>We can’t survive without performing that activity.</p><p>As time passes, it becomes more a necessity rather than pleasurable experience. It’s like we don’t feel better by wearing old clothes, it’s just that putting clothes is a necessity. The answer to the question: I know my addiction is injurious to me but still I can’t live without it. Because our brain has attached a survival value to that addiction. Addictions like Facebooking, masturbation, drugs, smoking​, alcohol, Snapchat, food, sugary soda, junk food, gambling affects the brain in a very similar way but drugs tops the list. The amount of dopamine released by the drugs are very very high and that much addictive they are!</p><p>So what can be done? The goal of this article is that when we perform any activity we should be fully aware, we can be easily able to prioritise our works, execute it without any distractions and not just because it feels good to do that work. Next time when you are about to practice your addiction think this “<strong>That freaking dopamine wanted to be release again, I should be one to control the brain, the brain can’t control me</strong>”.</p><p>Hope by reading this dopamine is released in your brain. Your Comments and suggestions matter me the most. If you liked it, press “💚” in the bottom.</p><p>Thank you!</p><p>-SodhA</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dae686ae731d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MISTAKES!]]></title>
            <link>https://medium.com/@vatsalsodha/mistakes-a293f4fad536?source=rss-835e06698e34------2</link>
            <guid isPermaLink="false">https://medium.com/p/a293f4fad536</guid>
            <category><![CDATA[life-lessons]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[happiness]]></category>
            <dc:creator><![CDATA[Vatsal Sodha]]></dc:creator>
            <pubDate>Thu, 12 May 2016 08:20:38 GMT</pubDate>
            <atom:updated>2016-05-12T08:20:38.559Z</atom:updated>
            <content:encoded><![CDATA[<p>MISTAKES!</p><p>We are committing many mistakes unknowingly, but they prove to be very destructive in future. Even if we have knowledge about that mistakes, we will commit it, because it’s basic human nature. So what’s the solution for these mistakes? The solution is, we need to change our view towards that mistakes(more on that later). Many such mistakes are:</p><blockquote>We do compare!</blockquote><p>Yes! We compare our success, wealth, marks, and the list is very long. What it brings in our mind is Negativity , and even sometimes hinders us from the happiness of our own achievements.</p><p>What we need to do is, we need to compare the amount of time, effort given by that person in achieving particular success. Then ask yourself, did I invested same amount of time on that field ? Sometimes what happens is we were comparing ourselves with one who had achieved success in the field, which is of not our interest even! It’s like an engineer comparing his success with a doctor !</p><p>Here what we need to observe is what were we doing during the time that successful person was doing all his hardwork? We will definitely find an answer. For example: If Joy is going to practice swimming everyday without fail and at the same time Rick is busy studying, then Joy can’t complaint of not having good grades as Rick! But at the same time Rick can’t swim as better as Joy!</p><p>Consequences of all above questions and answers will realize us, where we were wasting our time, where did our effort was weak. In short that comparisons will help us in self-betterment so,Do Compare!</p><blockquote>Expectations!</blockquote><p>We do expect people to behave in particular manner, we do expect some outcome of our own work and many other expectations. These expectations are root cause of, most of griefs people face in this world.</p><p>If two are in relationship, then one would expect from another to do that, or to behave in particular manner for particular situation! What’s this? Here we need to understand that Basic Nature of particular person can’t be changed by Us. If that person behaves in a manner we didn’t expect, then at that moment even we should discuss our expectations with that person Or leave your expectations.</p><p>I’m not telling we should not expect anything, but when we get hurted, we should ask ourselves that did I expected more from that person?</p><p>When it comes to work , expectation is necessary. We should have aim for the task we are doing, but if doesn’t get succeeded then we should atleast once ask ourselves that, did I expected more for the amount of time I spent on doing the task?</p><p>There will be many other expectations but don’t forget to ask that did I expected more?</p><p>-Vatsal</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a293f4fad536" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Many times I can’t complete my tasks which I had committed myself to complete it.]]></title>
            <link>https://medium.com/@vatsalsodha/many-times-i-cant-complete-my-tasks-which-i-had-committed-myself-to-complete-it-f4a0473913db?source=rss-835e06698e34------2</link>
            <guid isPermaLink="false">https://medium.com/p/f4a0473913db</guid>
            <category><![CDATA[mindfulness]]></category>
            <category><![CDATA[time-management]]></category>
            <category><![CDATA[steps-to-complete-task]]></category>
            <dc:creator><![CDATA[Vatsal Sodha]]></dc:creator>
            <pubDate>Sun, 08 May 2016 21:47:06 GMT</pubDate>
            <atom:updated>2016-05-09T11:09:21.186Z</atom:updated>
            <content:encoded><![CDATA[<p>Many times I can’t complete my tasks which I had committed myself to complete it. It brings negativity in your mind and nothing good going to happen. This happened with me many times so I decided to figure out the reason behind this and I found 3 simple steps which helps to complete your tasks.</p><blockquote>Step 1: Why you want to do that task?</blockquote><p>The first step is to ask yourself: Do you really need to do this? Or Are you interested in doing this ? If your mind say NO leave that task immediately. This will save your time in doing task which are never going to be completed by you. But in this world sometimes we are forced to do particular work in that case just find some reason to carry on the work. Here what makes the difference those who are successful will find reason and those who are complaining or arguing will stuck. Or what you can do is periodically switch between tasks which you like and which you don’t like (it really helps). The reason is our mind will always be attracted towards the stuffs which we like and ignore the stuffs which either you don’t like or which is difficult, at that time we need to create balance between both the stuffs. It’s like if you continously teach a child he will be bored and then starts to ignore you but if in between you give him a play time then??</p><blockquote>Step 2: Clear the vision !</blockquote><p>I read in Tiger Woods article that:</p><p>“I would not hit the ball until i see that ball is going in hole”</p><p>What it implies is you have to just imagine that you had completed the task, just feel the satisfaction of completion of task, feel that success , feel the happiness , appreciate yourself on completing the task . What this would do is it triggers a positive energy in your mind and body , which helps a lot in completing your task.</p><blockquote>Step 3: Just do it!</blockquote><p>Here GOOGLE comes in handy. Try to find the quickest and easiest way to complete the task , go through the experience of person who already done that task. Find your way to reach to your destination. Once you find your way, then during the journey don’t rush into things as I said earlier our mind is like child, it needs appreciation if it achieve something however small it is right ?? So reward yourself on completing subtasks. You will definitely reach at the shore.</p><p>This really worked for me hope it helps for you even.</p><p>Inspired from Sandeep Maheshwari</p><p>-Vatsal</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4a0473913db" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>