<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="/rss.xsl" type="text/xsl"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Amey Agrawal</title><description>Co-founder &amp; CEO of Avartha. PhD, Georgia Tech.</description><link>https://agrawalamey.github.io</link><item><title>Speeding up graphics intense websites</title><link>https://agrawalamey.github.io/posts/2017-01-07-page-speed</link><guid isPermaLink="true">https://agrawalamey.github.io/posts/2017-01-07-page-speed</guid><description>Tips and tricks to make websites load faster.</description><pubDate>Sat, 07 Jan 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;College fests are irreplaceable delights of a college student&apos;s life. Each college tries to make its fest bigger yet different than others&apos; and so is case with fest websites. These fest websites stand as expression of creativity of its makers which more often than not leads to a large page load time and poor user experience. While working on websites for &amp;lt;a target=&apos;_blank&apos; href=&quot;http://bits-oasis.org/2015main/&quot;&amp;gt; Oasis &amp;lt;/a&amp;gt; and &amp;lt;a target=&apos;_blank&apos; href=&quot;http://bits-apogee.org/2016/&quot;&amp;gt; Apogee &amp;lt;/a&amp;gt; at Department of Visual Media, I explored a few techniques to make the sites faster. Here are a few of them. Both graphics designers and front-end developers might find the blog helpful.&lt;/p&gt;
&lt;h3&gt;1. Choose the right file format&lt;/h3&gt;
&lt;p&gt;This is the most basic yet the most effective step of all. With improved browser rendering engines, SVG files have gained popularity in the web design domain. Being vectors they scale up with screen sizes without any depreciation in quality and they are lightweight. As a bonus they support animations and JavaScript interactions.&lt;/p&gt;
&lt;p&gt;But sometimes designs contain textures which cannot be recreated in vectors, in such situations one has to choose between JPEG and PNG? This question does not have a generic answer as JPEG uses lossy data compression unlike PNG and hence is always smaller in size but the lossy compression has it&apos;s own implications. For example, text in JPEG images is blurred out on edges. PNG also supports the use of transparency which makes its use as a necessity at times.&lt;/p&gt;
&lt;p&gt;Just choosing the right file format can save up of to 80% payload in images.&lt;/p&gt;
&lt;h3&gt;2. Select the right export settings&lt;/h3&gt;
&lt;p&gt;Many designers tend to ignore this part which can actually turn out to be very crucial while exporting to raster formats (JPEG and PNG). Typically printers use CMYK colors (32 bit) and hence a lot of design tools export using this format by default. This leads to a problem when rendering on the web as it only supports RGB colors (24 bit) although, a browser would display a CMYK image it cannot reproduce the exact colors. Apart from this, JPEG also supports grayscale colors (8 bit). Progressive and Optimized JPEGs can provide significant reduction in size. As a rule of thumb you might use baseline optimized JPEGs but I strongly suggest going through &amp;lt;a target=&apos;_blank&apos; href=&quot;https://www.google.co.in/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;uact=8&amp;amp;ved=0ahUKEwiDpYncjLDRAhXFOo8KHVvLBs8QFggZMAA&amp;amp;url=https%3A%2F%2Fforums.adobe.com%2Fthread%2F1962929&amp;amp;usg=AFQjCNGcfh77OnWkOA99LnDRVfTQ7G0GWQ&amp;amp;sig2=5wkjdUoFPIhqeqCC66PFQg&quot;&amp;gt; [1] &amp;lt;/a&amp;gt; and &amp;lt;a target=&apos;_blank&apos; href=&quot;http://superuser.com/questions/379404/what-is-the-difference-between-progressive-and-optimized-jpegs-in-photostop&quot;&amp;gt; [2] &amp;lt;/a&amp;gt;.&lt;/p&gt;
&lt;p&gt;PNG provides with four color modes of which 24 bit RGB and 8 bit paletted are of interest to us. Typically you would use RGB colors, but if the image does not contain too many colors 8 bit paletted colors might turn out to be better. Converting the image to 8 bit color mode would entail choosing only the best 256 colors, thus drastically decreasing the size of the image. As a word of caution, using paletted color modes can sometimes increase the size of the image when the dimensions of image are small. &amp;lt;a target=&apos;_blank&apos; href=&quot;http://help.adobe.com/en_US/creativesuite/cs/using/WSC7A1F924-DD38-49b4-B84B-EFF50416C860.html&quot;&amp;gt; [3] &amp;lt;/a&amp;gt; is a great read about the tweaks discussed above.&lt;/p&gt;
&lt;h3&gt;3. Compress your files&lt;/h3&gt;
&lt;p&gt;Though file compression is the most obvious step in decreasing page load time, it is still not performed right most of the times. For all your text files HTML, Js, CSS, JSON, etc. &quot;minify&quot; (whitespace removal) is the most popular compression technique available. Though it might appear to be elementary, its aggregate impact could be significant. Most modern text editors like Sublime Text and Atom have plugins for minification. You can also add this to your gulp/grunt build process.&lt;/p&gt;
&lt;p&gt;Different image formats have different compression techniques and there exist great open source utilities like &amp;lt;a target=&apos;_blank&apos; href=&quot;http://www.kokkonen.net/tjko/projects.html&quot;&amp;gt; JPEGOptim &amp;lt;/a&amp;gt; , &amp;lt;a target=&apos;_blank&apos; href=&quot;http://www.advsys.net/ken/util/pngout.htm&quot;&amp;gt; PNGOUT &amp;lt;/a&amp;gt; and &amp;lt;a target=&apos;_blank&apos; href=&quot;https://github.com/svg/svgol&quot;&amp;gt; SVGO &amp;lt;/a&amp;gt; which can decrease the file size by up to 70%. I personally prefer &amp;lt;a target=&apos;_blank&apos; href=&quot;https://github.com/toy/image_optim&quot;&amp;gt; image_optim &amp;lt;/a&amp;gt; which combines all these packages, provides a handy shell interface which works for all image formats and integrates easily into build processes. But setting up image_optim on Windows is tricky, if you are on Windows you might want to install those utilities individually or you could alternatively use &amp;lt;a target=&apos;_blank&apos; href=&quot;https://tinypng.com/&quot;&amp;gt; TinyPNG &amp;lt;/a&amp;gt; for rasters and &amp;lt;a target=&apos;_blank&apos; href=&quot;https://jakearchibald.github.io/svgomg/&quot;&amp;gt; SVGOMG &amp;lt;/a&amp;gt; for SVGs.&lt;/p&gt;
&lt;p&gt;Most compression techniques in the above mentioned utilities are lossy hence deal with them cautiously.&lt;/p&gt;
&lt;h3&gt;4. Use gzip compression&lt;/h3&gt;
&lt;p&gt;Browsers can decode gzip encoded responses from a server. gzip does not help much with raster images but manages to compress text files to about one tenth their original size. This provides massive savings with minimum efforts and gzip compression can be easily enabled on both apache and nginx. &amp;lt;a target=&apos;_blank&apos; href=&quot;https://varvy.com/pagespeed/enable-compression.html&quot;&amp;gt; [4] &amp;lt;/a&amp;gt; explains this process in a simple manner.&lt;/p&gt;
&lt;p&gt;Fun fact, SVG files are just XML documents because of which gzip works great on them as well. The complete isometric map of the miniature city on the landing page of Apogee 2016 website mentioned earlier is a single ginormous SVG file of about 2 MBs. SVGO compression decreased it to half and ultimately with gzip it is transferred as a payload of only about 200 KBs.&lt;/p&gt;
&lt;h3&gt;5. Avoid loading multiple fonts&lt;/h3&gt;
&lt;p&gt;Fonts make websites seem beautiful but they can also make them lethargic. Google Fonts is by and far the best option to load fonts on the web almost all the fonts (or their similar alternatives) are available on Google Fonts. As browsers cache fonts, many a times the Google Fonts font you are trying to load might already be in the user’s cache. Also, we might only need one or two font-weights for a given font which we can choose to load selectively in Google Fonts thus dramatically reducing the size.&lt;/p&gt;
&lt;p&gt;If you need a font only for some titles, it might be a good idea to export those as SVGs instead. Though a bit tedious, this leads to big savings as it removes the barrier to your creative ideas.&lt;/p&gt;
&lt;h3&gt;5. Lazy load files&lt;/h3&gt;
&lt;p&gt;Loading all the content at once might make the loading times large specially in one page sites. Lazy loading files of less importance might turn out to be useful, &amp;lt;a target=&apos;_blank&apos; href=&quot;http://sourcey.com/recliner/&quot;&amp;gt; Recliner.js &amp;lt;/a&amp;gt; is a great tool to achieve the same.&lt;/p&gt;
&lt;h3&gt;6. Decrease the number of requests&lt;/h3&gt;
&lt;p&gt;Decreasing the number of HTTP requests can make your page load significantly faster. &amp;lt;a target=&apos;_blank&apos; href=&quot;https://www.giftofspeed.com/fewer-http-requests/&quot;&amp;gt; [5] &amp;lt;/a&amp;gt; describes different ways you can achieve the same. Apart from the ones described above, SVG sprites are useful in decreasing number of requests. &amp;lt;a target=&apos;_blank&apos; href=&quot;https://github.com/jkphl/svg-sprite&quot;&amp;gt; svg-sprite &amp;lt;/a&amp;gt; is a useful tool for making SVG sprites.&lt;/p&gt;
&lt;p&gt;HTTP/2 would completely change this landscape though, you can read more about it in &amp;lt;a target=&apos;_blank&apos; href=&quot;https://blog.newrelic.com/2016/02/09/http2-best-practices-web-performance/&quot;&amp;gt; [6]&amp;lt;/a&amp;gt;.&lt;/p&gt;
&lt;h3&gt;7. Enable caching&lt;/h3&gt;
&lt;p&gt;Caching the less frequently changed files makes pages load super-fast for returning users. &amp;lt;a target=&apos;_blank&apos; href=&quot;https://betterexplained.com/articles/how-to-optimize-your-site-with-http-caching/&quot;&amp;gt; [7]&amp;lt;/a&amp;gt; walks through enabling caching in apache, for nginx you might want to refer &amp;lt;a target=&apos;_blank&apos; href=&quot;https://www.nginx.com/blog/nginx-caching-guide/&quot;&amp;gt; [8]&amp;lt;/a&amp;gt;.&lt;/p&gt;
&lt;p&gt;I hope that this posts helps in making your sites faster. If you have any suggestions please let me know in the comments below and I will surely take them into consideration next time! :-) Thank you!&lt;/p&gt;
</content:encoded><author>Amey Agrawal</author></item><item><title>Jupyter In Classroom</title><link>https://agrawalamey.github.io/posts/2018-03-29-lessons-from-conducting-machine-learning-course-with-jupyter-notebooks</link><guid isPermaLink="true">https://agrawalamey.github.io/posts/2018-03-29-lessons-from-conducting-machine-learning-course-with-jupyter-notebooks</guid><description>The problems and solutions for conducting a machine learning course in Jupyter Notebooks.</description><pubDate>Thu, 29 Mar 2018 00:00:00 GMT</pubDate><content:encoded>&lt;h3&gt;Prologue&lt;/h3&gt;
&lt;p&gt;In recent years the popularity of machine learning and related courses has skyrocketed in BITS Pilani. Though during my junior year seven machine learning and data science courses were offered in Pilani, none taught the programming nuances required to effectively use the learnings in practice. I solved assignments from Stanford&apos;s &lt;a href=&quot;http://cs231n.stanford.edu&quot;&gt;CS 231n&lt;/a&gt; and &lt;a href=&quot;http://cs224d.stanford.edu/&quot;&gt;CS 224d&lt;/a&gt; in my free time to learn NumPy and TensorFlow however with six courses and three term project it was a strenuous task. Hence, &lt;a href=&quot;https://nikhilweee.github.io&quot;&gt;Nikhil Verma&lt;/a&gt; and I approached our project adviser Prof. Bhanot with some ideas to introduce Python-based learning components in her course on Neural Networks and Fuzzy Logic. Over the summers we charted the plan for the course and decided to have three assignments each followed by a programming test. Along with three other senior year teaching assistants we introduced the updated course during fall 2017.&lt;/p&gt;
&lt;h3&gt;Original Setup&lt;/h3&gt;
&lt;p&gt;Jupyter notebooks were the obvious choice for creating assignments. But the students who opted for the course came from diverse backgrounds. About half of them had never programmed in Python, the majority of EE students had programming experience limited to C and Matlab. We did not want them to spend time setting up Python environment. Following are the tools we employed to conduct the programming components considering the aforementioned constraints,&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Assignment Distribution:&lt;/strong&gt;  We used &lt;a href=&quot;https://notebooks.azure.com/nnfl/libraries&quot;&gt;Azure Notebooks&lt;/a&gt; to distribute assignments and tutorials for the course. Students could directly clone the assignment libraries and click to launch the notebooks.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Evaluating Submissions:&lt;/strong&gt; An awesome open source project &lt;a href=&quot;http://nbgrader.readthedocs.io/en/stable/&quot;&gt;nbgrader&lt;/a&gt; turned out to be super helpful in creating and evaluating assignments in Jupyter notebooks.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Test Portal:&lt;/strong&gt; We needed a way to collect the submissions during the lab tests. &lt;code&gt;nbgrader&lt;/code&gt; integrates with JupyterLab but we could not cater to 150 users on the spare machine we had borrowed from one the general computer science labs to host the service. None of the competitive coding platforms provided on option to host Jupyter notebooks up to our knowledge. So we decided to write a simple &lt;a href=&quot;https://expressjs.com&quot;&gt;Express&lt;/a&gt; web app which allowed students to upload the solutions as zips. We installed &lt;a href=&quot;https://anaconda.org/&quot;&gt;Anaconda 3.6&lt;/a&gt; along with &lt;a href=&quot;https://github.com/takluyver/nbopen&quot;&gt;nbopen&lt;/a&gt; on each of the lab systems.&lt;/p&gt;
&lt;h3&gt;The snags&lt;/h3&gt;
&lt;p&gt;Though Azure notebooks were handy, they were slow, combined with the slow internet connections in hostels they lead to a terrible user experience. During the tests students&apos; uploaded zips, hardly ever followed the instructions. They had different directory structures, multiple copies of same notebook and renamed files. I wrote &lt;a href=&quot;https://gist.github.com/AgrawalAmey/4e499d0334e4d05c783cd8504fe7fe82&quot;&gt;this&lt;/a&gt; shell script to sanitize the submissions by comparing the notebooks to the original problem notebooks. The poor internet connection also made it difficult to download Anaconda and to install TensorFlow, Pytorch and other deep learning libraries which were crucial for the term project.&lt;/p&gt;
&lt;h3&gt;Enters Callisto&lt;/h3&gt;
&lt;p&gt;Due to the increased popularity of the course, it was decided to run the course during both the semester. I along with &lt;a href=&quot;https://github.com/shrikantsharda&quot;&gt;Shrikant Sharda&lt;/a&gt; decided to fix the issues we had faced in the previous offering of the course. We need to eliminate the need to hit the internet altogether and make all the resources available on the intranet. We decided to build an &lt;a href=&quot;http://electron.atom.io&quot;&gt;electron&lt;/a&gt; app, Callisto which would be bundled with Anaconda. We decided to keep most of the back-end components intact form our original express server which used &lt;a href=&quot;https://www.npmjs.com/package/ejs&quot;&gt;ejs&lt;/a&gt; templates. Following are some of the neat features this app facilitated,&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Cross-Platform Zero-Setup Jupyter Notebooks:&lt;/strong&gt;  We bundled Anaconda 3.6 and archives for some deep learning libraries along with the app. With some hacks (read installing anaconda on Windows via command line) we were able to ensure that regardless of which platform you are on, opening the app for the first time automatically installs an isolated Anaconda environment with all the necessary libraries with zero efforts.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Azure Notebooks/Google Colab Like Experience But Faster:&lt;/strong&gt; The electron app communicates with the express server to fetch the assignments and orchestrates Jupyter notebook server. Hence, the user gets the same click to launch notebook experience we loved about Azure notebooks but faster, since the notebook server runs locally on the user&apos;s system.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Hassle Free Submission:&lt;/strong&gt; With the new app, the workflow for students is identical whether they are solving assignments in their hostels or appearing for the test in labs. To submit a notebook the user just has to press the submit button. This also ensures the sanity of submissions.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Bundled Docs:&lt;/strong&gt; We included documentations for Python, NumPy, Matplotlib along with several tutorials and cheat sheets in the app so that students do not have to navigate out to look for reference resources.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Improved Performance On Web Server:&lt;/strong&gt; We still render most views displayed within the app on our back-end web server which enables us to push front-end updates without requiring a user-side update of the app. However, all the static resources are already bundled on the client app which dramatically improved the performance of our server; especially during the first few minutes of the test, when all the users would typically download the archives of Python documentation in the old workflow.&lt;/p&gt;
&lt;p&gt;&amp;lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;https://www.youtube.com/embed/fiKaIJcfsAs&quot; frameborder=&quot;0&quot; allow=&quot;autoplay; encrypted-media&quot; allowfullscreen&amp;gt;&amp;lt;/iframe&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;br&amp;gt;&lt;/p&gt;
&lt;p&gt;The YouTube video above provides a tour of all the features for students. The source code for the app and server is available &lt;a href=&quot;https://github.com/AgrawalAmey/nnfl-app&quot;&gt;here&lt;/a&gt; on GitHub. Apart from the app, we are also running a &lt;a href=&quot;https://jekyllrb.com/&quot;&gt;Jekyll&lt;/a&gt; site for the listing of suggested term-project topics &lt;a href=&quot;https://nnfl.github.io&quot;&gt;here&lt;/a&gt;. We used old-school google forms with &lt;a href=&quot;https://chrome.google.com/webstore/detail/choice-eliminator-2/mnhoinjhhhafgieggnhjekliaodnkigj?utm_source=permalink&quot;&gt;choice eliminator 2 &lt;/a&gt; to allocate the project topics on a first come first serve basis.&lt;/p&gt;
&lt;h3&gt;Some interesting ideas&lt;/h3&gt;
&lt;p&gt;Though the app&apos;s performance was functionally good during the two lab tests we conducted so far there are quite a few rough edges which need to be fixed. But following are some of the more interesting ideas we think could be incorporated in the app in future.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Remote Storage of Notebooks:&lt;/strong&gt; Currently the notebooks are stored locally and any changes students make in their assignment notebooks do not reflect when logged in from another machine. Syncing the files to the remote server could fix this problem.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Consensus Protocols For Real-Time Grading:&lt;/strong&gt; One of the biggest downsides of our current setup is that students cannot check if their submission passed the hidden test cases and receive the scores only after we manually run &lt;code&gt;nbgrader&lt;/code&gt; on their submissions. One possible way to overcome the limitation put forward by the lack of server-side computer resources could be to use all the client systems with consensus protocol.&lt;/p&gt;
&lt;h3&gt;Future of The Project&lt;/h3&gt;
&lt;p&gt;I would graduate from BITS next month and would be focusing more on my research projects here on. If anyone finds this project useful please help us maintain and improve it.&lt;/p&gt;
</content:encoded><author>Amey Agrawal</author></item><item><title>A Data Driven Analysis of Indian Engineering Colleges</title><link>https://agrawalamey.github.io/posts/2018-05-12-a-data-driven-analysis-of-indian-engineering-colleges</link><guid isPermaLink="true">https://agrawalamey.github.io/posts/2018-05-12-a-data-driven-analysis-of-indian-engineering-colleges</guid><description>Why do we rank so low?</description><pubDate>Sat, 12 May 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;During the recent protests against the fee hike at BITS Pilani, certain students claimed that the quality of education at the institute had fallen in the recent years. The rankings released under the National Institute Ranking Framework (NIRF) 2018 were cited to corroborate the claim.  BITS is ranked at 17th overall and 26th by research in the MHRD approved rankings, hence I decided to investigate the ranking parameters. NIRF provides a rough outline of the methodology used  in &lt;a href=&quot;https://nirfcdn.azureedge.net/2018/framework/Engineering.pdf&quot;&gt;this document&lt;/a&gt;. The data provided by the institutes is also available for download in PDFs. However some of the critical details are missed out in the documentation, prohibiting the re-implementation of the ranking scores. &lt;a href=&quot;https://github.com/NirantK&quot;&gt;Nirant Kasliwal&lt;/a&gt; provided an insightful analysis of some of the aspects of the ranking in his &lt;a href=&quot;https://www.quora.com/Why-wasn%E2%80%99t-BITS-Pilani-on-the-list-of-the-Top-100-engineering-colleges-in-India-published-by-the-Ministry-of-Human-Resource-Development-Why-is-BITS-ranked-below-universities-like-JNU-and-Tezpur-University-whereas-IITs-are-nowhere-to-be-found/answer/Nirant-Kasliwal?share=52b709fa&amp;amp;srid=p2LP&quot;&gt;quora answer&lt;/a&gt;. I would only focus on certain aspects. Some of the following results also provide hints to why Indian academic research ecosystem fails to perform at par with it&apos;s international counterparts.&lt;/p&gt;
&lt;h2&gt;Understanding the research score criterion&lt;/h2&gt;
&lt;p&gt;NIRF defines Research and Professional Practice (RP) score which reflects the publications and patents published along with sponsored research and consultancy projects undertaken in past three years. RP is a combination of four individual matrices defined as,&lt;/p&gt;
&lt;p&gt;$$ RP = PU + QP + IPR + FPPP $$&lt;/p&gt;
&lt;h3&gt;Combined metric for publications (PU)&lt;/h3&gt;
&lt;p&gt;$$ PU = 35 × f(P/F_{RQ}) $$&lt;/p&gt;
&lt;p&gt;Here, $$P$$ is the total number of publications and $$F_{RQ}$$ is the nominal number of faculty members. $$f$$ is some function whose value lies between $$[0, 1]$$, however the exact definition is missing.&lt;/p&gt;
&lt;h3&gt;Combined metric for quality of publications (QP)&lt;/h3&gt;
&lt;p&gt;$$ QP = 20 × f (CC/P) + 20× f (TOP25P/P) $$&lt;/p&gt;
&lt;p&gt;Here, $$CC$$ is Total Citation Count over previous three years and $$TOP25P$$ is the number of citations in top 25 percentile averaged over the previous three years.&lt;/p&gt;
&lt;h3&gt;Patents published and granted (IPR)&lt;/h3&gt;
&lt;p&gt;$$ IPR = 10× f (PG) + 5 × f (PP)$$&lt;/p&gt;
&lt;p&gt;$$PG$$ is the number of patents granted while $$PP$$ is the number of patents published over the previous three years.&lt;/p&gt;
&lt;h3&gt;Footprint of projects and professional practice (FPPP)&lt;/h3&gt;
&lt;p&gt;$$ FPPP = 7.5 × f (RF) + 2.5 × f (CF) $$&lt;/p&gt;
&lt;p&gt;Where, $$RF$$ is average annual research funding earnings and $$CF$$ annual consultancy amount per faculty at institute level in previous three years.&lt;/p&gt;
&lt;h3&gt;Factors which decide the rankings&lt;/h3&gt;
&lt;p&gt;The largest contributor to the final score is the quality index, $$QP$$ which caries forty-percent weightage. The following graph represents the average number of citations per paper.&lt;/p&gt;
&lt;p&gt;&amp;lt;iframe width=&quot;700&quot; height=&quot;500&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; src=&quot;/images/posts/nirf/scatter_plots/citation.html&quot;&amp;gt;&amp;lt;/iframe&amp;gt;&lt;/p&gt;
&lt;p&gt;One can notice that the variation in the average number of citations is small and mostly lies between two and four citations. This implies that there is only a small variation in the quality of an average publication among the top 100 colleges. Hence, we would expect $$QP$$ to not cause as much of difference. The small weight for $$IPR$$ and $$FPPP$$ makes them insignificant while analyzing the overall trend of RP rankings. $$PU$$ or the average publications per faculty seems to be the single biggest factor in deciding the RP rankings. Since, the function $$f$$ is not defined in the document I assume it to be the min-max scaling function for rest of this article.&lt;/p&gt;
&lt;p&gt;$$ f(X) = \frac{X - X_{min}}{X_{max} - X_{min}} $$&lt;/p&gt;
&lt;p&gt;At this point one might be tempted to think why are we considering the publication per faculty and not the total number of publications. This is probably to accommodate for the different sizes of colleges. The following plot shows the number of variation of publication per faculty with change in number of faculty and change in number of PhD students. The color of marker represents the RP score.&lt;/p&gt;
&lt;p&gt;&amp;lt;iframe width=&quot;700&quot; height=&quot;500&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; src=&quot;/images/posts/nirf/scatter_plots/und_rp.html&quot;&amp;gt;&amp;lt;/iframe&amp;gt;&lt;/p&gt;
&lt;p&gt;We notice that as per our assumption higher publication per faculty leads to higher RP scores. Also, the metric does not show any direct trend with the number of faculty members as per intended. But a clear trend is observable when compared by the total number of PhD students. Higher the number of PhD scholars leads to higher per faculty publication and hence higher RP. Since PhD students are directly responsible for publications this seems logical to compare publications per PhD student instead of faculty.&lt;/p&gt;
&lt;h3&gt;The PhD student crisis&lt;/h3&gt;
&lt;p&gt;PhD students drive the research outcome at any university. Only five colleges among NIRF&apos;s list of top hundred engineering colleges have a healthy average of more than four PhD students per faculty. 37 colleges have less than a single PhD student per faculty.&lt;/p&gt;
&lt;p&gt;&amp;lt;iframe width=&quot;700&quot; height=&quot;500&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; src=&quot;/images/posts/nirf/misc/pfr_line.html&quot;&amp;gt;&amp;lt;/iframe&amp;gt;&lt;/p&gt;
&lt;p&gt;For reference MIT&apos;s school of engineering admitted 2105 PhD students in 2017-2018 alone &lt;a href=&quot;http://web.mit.edu/facts/enrollment.html&quot;&gt;[1]&lt;/a&gt;, while it has 378 faculty members &lt;a href=&quot;http://web.mit.edu/facts/faculty-by-school.html&quot;&gt;[2]&lt;/a&gt;. Similarly, UC Berkeley engineering has 229 faculty &lt;a href=&quot;https://engineering.berkeley.edu/about/facts-and-figures&quot;&gt;[3]&lt;/a&gt; and enrolled 1332 PhD students in Fall 2017 &lt;a href=&quot;http://grad.berkeley.edu/wp-content/uploads/berkeley_grad_profile.pdf&quot;&gt;[4]&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Notably, a new UGC guidelines which restricts the number a professor, an associate professor and an assistant professor can guide to eight, six and four respectively lead to a strike in JNU &lt;a href=&quot;https://scroll.in/article/832721/jnu-is-on-strike-against-drastic-cut-in-phd-and-mphil-seats-but-all-universities-will-be-hit&quot;&gt;[5]&lt;/a&gt; last year.&lt;/p&gt;
&lt;p&gt;BITS Pilani is one of the worst hit universities with a mere PhD to faculty ratio of 0.41. Probably some of the readers know more about why BITS has so few PhD scholars. The following plot shows the top 20 colleges ranked by publication per PhD student over last three years.&lt;/p&gt;
&lt;p&gt;&amp;lt;iframe width=&quot;700&quot; height=&quot;500&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; src=&quot;/images/posts/nirf/bar_graphs/pubphdr.html&quot;&amp;gt;&amp;lt;/iframe&amp;gt;&lt;/p&gt;
&lt;h2&gt;Accommodating for the skew&lt;/h2&gt;
&lt;p&gt;To equate for this high imbalance in the number of PhD students I defined a function which quantifies the productivity of a faculty member as a function of number of PhD students.&lt;/p&gt;
&lt;p&gt;&amp;lt;iframe width=&quot;700&quot; height=&quot;500&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; src=&quot;/images/posts/nirf/misc/fac_emp.html&quot;&amp;gt;&amp;lt;/iframe&amp;gt;&lt;/p&gt;
&lt;p&gt;We can use the above stated function to define &apos;Effective Faculty Units&apos; ($$EFU$$) as the product of total number of faculty and productivity function. Also, the original $$IPR$$ score does not factor for the number of faculty so I decided to update the metric to factor in for $$EFU$$ as well.&lt;/p&gt;
&lt;p&gt;$$RP_{EFU} = PU_{EFU} + QP + IPR_{EFU} + FPPP_{EFU}$$&lt;/p&gt;
&lt;p&gt;$$PU_{EFU} = 35 × f(P/EFU)$$&lt;/p&gt;
&lt;p&gt;$$IPR_{EFU} = 10× f(PG/EFU) + 5 × f(PP/EFU)$$&lt;/p&gt;
&lt;p&gt;$$FPPP_{EFU} = 7.5 × f (\frac{RF * F}{EFU}) + 2.5 × f (\frac{CF * F}{EFU})$$&lt;/p&gt;
&lt;p&gt;The following plot shows that unlike $$RF$$, $$RF_{EFU}$$ is not biased towards colleges with large number of PhD students.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Here on for most of the analysis we only consider the colleges which have more than two hundred faculty members and hundred PhD students.&lt;/p&gt;
&lt;p&gt;&amp;lt;iframe width=&quot;700&quot; height=&quot;500&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; src=&quot;/images/posts/nirf/scatter_plots/und_rp_norm_fac.html&quot;&amp;gt;&amp;lt;/iframe&amp;gt;&lt;/p&gt;
&lt;h3&gt;Does our metric capture the quality of research?&lt;/h3&gt;
&lt;p&gt;One concern I had while adding more importance to publications per PhD student was, what if the pressure of publishing more on a PhD student adversely affect the quality of publications. As it turns out $$RP_{EFU}$$ captures the quality of publication pretty well.&lt;/p&gt;
&lt;p&gt;&amp;lt;iframe width=&quot;700&quot; height=&quot;500&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; src=&quot;/images/posts/nirf/scatter_plots/citation_pfr.html&quot;&amp;gt;&amp;lt;/iframe&amp;gt;&lt;/p&gt;
&lt;p&gt;The above plot shows that the citations per paper increase with increasing $$RP_{EFU}$$ score. The plot also shows that a lower PhD student to faculty ratio (denoted by color) does not imply lower publication quality.&lt;/p&gt;
&lt;p&gt;Following are the top twenty colleges based on $$RP_{EFU}$$.&lt;/p&gt;
&lt;p&gt;&amp;lt;iframe width=&quot;700&quot; height=&quot;500&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; src=&quot;/images/posts/nirf/bar_graphs/rp_by_fac_prod.html&quot;&amp;gt;&amp;lt;/iframe&amp;gt;&lt;/p&gt;
&lt;p&gt;Please note that some of the institutes listed are barely above the threshold of size specified earlier.&lt;/p&gt;
&lt;h3&gt;Sponsored research projects&lt;/h3&gt;
&lt;p&gt;$$RP$$ takes into account sponsored research project and consultancy project funding. Following graphs represent the top 20 colleges bagging most funding in the past three years. The old IITs received significantly larger funds. Here we only show plots for sponsored research funding as it represents the majority of contribution. BITS looks largely underfunded compared to IITs.&lt;/p&gt;
&lt;p&gt;&amp;lt;iframe width=&quot;700&quot; height=&quot;500&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; src=&quot;/images/posts/nirf/bar_graphs/res_funding_bar.html&quot;&amp;gt;&amp;lt;/iframe&amp;gt;&lt;/p&gt;
&lt;p&gt;The following graph represents the research project funding (represented by the color) in past three year per PhD student against $$RP_{EFU}$$ and perception score.&lt;/p&gt;
&lt;p&gt;&amp;lt;iframe width=&quot;700&quot; height=&quot;500&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; src=&quot;/images/posts/nirf/scatter_plots/srpa_phd_rp_scatter.html&quot;&amp;gt;&amp;lt;/iframe&amp;gt;&lt;/p&gt;
&lt;h2&gt;Graduate outcome&lt;/h2&gt;
&lt;p&gt;The graduate outcome metric puts twenty percent weight on average number of PhD scholars graduated in past three years. Which makes quite biased towards institutes with large number of PhD students. It also involves a term considering the number of students who opted higher studies in past years, however the document does not provide sufficient information on how this number is calculated. However, we do get some interesting placement statistics.&lt;/p&gt;
&lt;p&gt;&amp;lt;iframe width=&quot;700&quot; height=&quot;500&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; src=&quot;/images/posts/nirf/bar_graphs/ug_salary.html&quot;&amp;gt;&amp;lt;/iframe&amp;gt;&lt;/p&gt;
&lt;p&gt;The above plot shows the top 20 colleges based on the median salary of placed students. However, these numbers should be taken with a grain of salt as they do not carry sector-wise figures.&lt;/p&gt;
&lt;p&gt;&amp;lt;iframe width=&quot;700&quot; height=&quot;500&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; src=&quot;/images/posts/nirf/bar_graphs/ug_salary.html&quot;&amp;gt;&amp;lt;/iframe&amp;gt;&lt;/p&gt;
&lt;p&gt;When plotted against the median salary the popularly known &apos;premier&apos; institutes of India become distinctly recognizable.&lt;/p&gt;
&lt;p&gt;&amp;lt;iframe width=&quot;700&quot; height=&quot;500&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; src=&quot;/images/posts/nirf/scatter_plots/place_rp_ps.html&quot;&amp;gt;&amp;lt;/iframe&amp;gt;&lt;/p&gt;
&lt;h2&gt;Perception score&lt;/h2&gt;
&lt;p&gt;Perception score only counts 10% towards the final ranking but is probably the most biased component of the rankings. The methodology for calculating perception score is not documented. Commonly Indian engineering colleges are perceived in tiers, the tier one institutes consisting of old IITs, tier two involving NITs and so on. However, the perception score is modeled as an exponentially decreasing function, which might lead to larger changes in overall ranking despite it&apos;s small weight. The last plot also depicts the bias in perception score.&lt;/p&gt;
&lt;p&gt;&amp;lt;iframe width=&quot;700&quot; height=&quot;500&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; src=&quot;/images/posts/nirf/bar_graphs/ps.html&quot;&amp;gt;&amp;lt;/iframe&amp;gt;&lt;/p&gt;
&lt;h2&gt;Scholarships&lt;/h2&gt;
&lt;p&gt;Scholarships provides for welfare of underprivileged students. But it also serves as a means to attract students. Surprisingly, the top ranking colleges are not the ones receiving the largest government scholarships.&lt;/p&gt;
&lt;p&gt;&amp;lt;iframe width=&quot;700&quot; height=&quot;500&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; src=&quot;/images/posts/nirf/scatter_plots/gov_schol_scatter.html&quot;&amp;gt;&amp;lt;/iframe&amp;gt;
&amp;lt;iframe width=&quot;700&quot; height=&quot;500&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; src=&quot;/images/posts/nirf/scatter_plots/insti_schol_scatter.html&quot;&amp;gt;&amp;lt;/iframe&amp;gt;&lt;/p&gt;
&lt;h2&gt;Epilogue&lt;/h2&gt;
&lt;p&gt;BITS is home to some of the professors and students I deeply admire. The significantly lower research funding and lack of PhD students makes it much harder for professors to do research. But still we do perform fairly well when compared in fair conditions. Maintaining the quality of education and research is a continuous effort and requires a combined effort from administration, faculty members and students. Those who feel that the quality of education at BITS has declined should find ways contributing towards it&apos;s improvement, you would discover some of the most supportive teachers.&lt;/p&gt;
&lt;p&gt;I have added many more interesting plots and tables &lt;a href=&quot;/nirf-supplementary.html&quot;&gt;here&lt;/a&gt;. The code for this project is available on &lt;a href=&quot;https://github.com/AgrawalAmey/nirf&quot;&gt;GitHub&lt;/a&gt;. Although I only presented analysis for engineering colleges here, the parsers works for all categories in the ranking framework.&lt;/p&gt;
&lt;p&gt;With &amp;lt;span style=&quot;color:red; font-size:24px&quot;&amp;gt;♥&amp;lt;/span&amp;gt; for BITS,
Signing off 2014A7PS0148P.&lt;/p&gt;
</content:encoded><author>Amey Agrawal</author></item><item><title>Geometric Transformations with Autoencoders</title><link>https://agrawalamey.github.io/posts/2018-08-27-neural-transformation</link><guid isPermaLink="true">https://agrawalamey.github.io/posts/2018-08-27-neural-transformation</guid><description>My attempt at disentanglement learning</description><pubDate>Mon, 27 Aug 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;During my last semester at BITS I was working with &lt;a href=&quot;http://ktiwari.in/&quot;&gt;Prof. Tiwari&lt;/a&gt; on indexing iris images. Unfortunately, given the short time frame, we could not complete the project, however here I would share some experiments I enjoyed performing.&lt;/p&gt;
&lt;p&gt;The traditional pre-processing pipeline for iris images includes two stages, segmentation and normalization with Daugman&apos;s rubber sheet model.&lt;/p&gt;
&lt;p&gt;&amp;lt;figure&amp;gt;
&amp;lt;img style=&quot;width:70%&quot; src=&quot;/images/posts/transforms/daugman_1.png&quot; /&amp;gt;
&amp;lt;figsource&amp;gt;Credits: &amp;lt;a target=&quot;_blank&quot; href=&quot;https://www.worldscientific.com/doi/abs/10.1142/S0218001415560169&quot;&amp;gt;Al-Zubi et al.&amp;lt;/a&amp;gt;&amp;lt;/figsource&amp;gt;
&amp;lt;figcaption&amp;gt;&amp;lt;b&amp;gt;Figure 1:&amp;lt;/b&amp;gt; Daugman&apos;s rubber sheet model&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;figure&amp;gt;
&amp;lt;img src=&quot;/images/posts/transforms/daugman_2.jpeg&quot; /&amp;gt;
&amp;lt;figsource&amp;gt;Credits: &amp;lt;a target=&quot;_blank&quot; href=&quot;https://ieeexplore.ieee.org/document/5304768/&quot;&amp;gt;Han et al.&amp;lt;/a&amp;gt;&amp;lt;/figsource&amp;gt;
&amp;lt;figcaption&amp;gt;&amp;lt;b&amp;gt;Figure 2:&amp;lt;/b&amp;gt; Normalized iris image&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;&lt;/p&gt;
&lt;p&gt;What makes dealing with normalized iris images difficult is the horizontal translation which exists between the normalized samples of the same iris. &lt;a href=&quot;http://openaccess.thecvf.com/content_ICCV_2017/papers/Zhao_Towards_More_Accurate_ICCV_2017_paper.pdf&quot;&gt;Hom et al.&lt;/a&gt; use Fully Convolutional Network (FCN) to obtain a 2-D feature map and accounts for the translation at the matching time. But this approach has an &lt;em&gt;O(n)&lt;/em&gt; time complexity making it less suitable for matching indexing of large database. We wanted to use dense features with a staged regression model as described by &lt;a href=&quot;https://arxiv.org/pdf/1712.01208.pdf&quot;&gt;Kraska et al.&lt;/a&gt; for a possibility of &lt;em&gt;O(1)&lt;/em&gt; lookup.&lt;/p&gt;
&lt;p&gt;&amp;lt;figure&amp;gt;
&amp;lt;img style=&quot;width:58%&quot;                      src=&quot;/images/posts/transforms/horizontal-translation-iris.png&quot; /&amp;gt;
&amp;lt;figsource&amp;gt;Credits: &amp;lt;a target=&quot;_blank&quot; href=&quot;http://openaccess.thecvf.com/content_ICCV_2017/papers/Zhao_Towards_More_Accurate_ICCV_2017_paper.pdf&quot;&amp;gt; Hom et al.&amp;lt;/a&amp;gt;&amp;lt;/figsource&amp;gt;
&amp;lt;figcaption&amp;gt;&amp;lt;b&amp;gt;Figure 3:&amp;lt;/b&amp;gt; Horizontal translation in normalized iris images&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;&lt;/p&gt;
&lt;p&gt;In their paper on robotic grasping &lt;a href=&quot;https://arxiv.org/pdf/1603.02199.pdf&quot;&gt;Levin et al.&lt;/a&gt; add a motor command vector, a one-hot vector to an intermediate layer in CNN by tiling it to the same dimensions. I decided to use this cool trick to train an autoencoder like architecture to perform
translation and hopefully learn some translation invariant features.&lt;/p&gt;
&lt;p&gt;&amp;lt;figure&amp;gt;
&amp;lt;img style=&quot;width:50%&quot; src=&quot;/images/posts/transforms/vector-addtion-block.png&quot; /&amp;gt;
&amp;lt;figcaption&amp;gt;&amp;lt;b&amp;gt;Figure 4:&amp;lt;/b&amp;gt; Vector addition block&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;&lt;/p&gt;
&lt;p&gt;Before trying with the iris images I decided to verify if the technique could work on simpler dataset. So I did a couple of experiments with MNIST and Fashion-MNIST. We train the encoder in the standard way,
however we pass an extra 14-D one-hot vector to the decoder which represents the number of pixels the image is supposed to be translated by. In case of MNIST since every image is 28x28 pixels, we allow shift in quantums of 2 pixels hence creating 14 different possible outcomes.&lt;/p&gt;
&lt;p&gt;&amp;lt;figure&amp;gt;
&amp;lt;img src=&quot;/images/posts/transforms/mnist-translation.png&quot; /&amp;gt;
&amp;lt;figcaption&amp;gt;&amp;lt;b&amp;gt;Figure 5:&amp;lt;/b&amp;gt; Schematic representation of MNIST translation network&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;&lt;/p&gt;
&lt;p&gt;To prepare the training data we create five translated images with random corresponding every image in the MNIST train split.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;def translate_data(X, number_of_samples=5):
    &quot;&quot;&quot;
    Takes images from MNIST dataset as input
    and transforms them to create new to datset.

    :param X: (n, 28, 28) array containing original MNIST images
    :param number_of_samples: Number of samples to be generated from
                              each input image.
    :return: tuple of ((new_x, translation_vectors), new_y)
            new_x: (n * number_of_samples, 28, 28) array containing
                         images from the original datset.
            translation_vectors: (14,) one-hot array containing the amount
                                of translation applied to each corresponding
                                image in new_y
            new_y: (n * number_of_samples, 28, 28) array containing
                         translated images.
    &quot;&quot;&quot;
    new_x = []
    new_y = []
    translation_vectors = []

    for i in range(X.shape[0]):
        for _ in range(number_of_samples):
            translation = np.random.randint(0, 14) * 2
            # Copy image to new_x as it is
            new_x.append(X[i])
            # Perform translation and add image to new_y
            new_y.append(
                np.hstack([X[i, :, translation:],
                           X[i, :, :translation]]))
            translation_vector = np.zeros(14)
            translation_vector[translation // 2] = 1
            translation_vectors.append(translation_vector)

    new_x, translation_vectors, new_y = np.asarray(new_x), \
                                        np.asarray(translation_vectors), \
                                        np.asarray(new_y)

    return ((new_x, translation_vectors), new_y)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We then define the encoder network as a simple CNN,&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;def get_encoded(input_img):
    &quot;&quot;&quot;
    Defines the encoder network.
    :param input_image: A tensor containing input image
    :return: Tensor representing the encoded image
    &quot;&quot;&quot;
    x = Conv2D(16, (3, 3), activation=&apos;relu&apos;, padding=&apos;same&apos;)(input_img)
    x = BatchNormalization()(x)
    x = MaxPooling2D((2, 2), padding=&apos;same&apos;)(x)
    x = Conv2D(14, (3, 3), activation=&apos;relu&apos;, padding=&apos;same&apos;)(x)
    x = MaxPooling2D((2, 2), padding=&apos;same&apos;)(x)
    x = Conv2D(14, (3, 3), activation=&apos;relu&apos;, padding=&apos;same&apos;)(x)
    x = BatchNormalization()(x)
    x = MaxPooling2D((2, 2), padding=&apos;same&apos;)(x)
    x = Conv2D(14, (3, 3), activation=&apos;relu&apos;, padding=&apos;same&apos;)(x)
    encoded = MaxPooling2D((2, 2), padding=&apos;same&apos;)(x)

    return encoded
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Since defining the decoder all at once could be a mouthful we create a helper method
which returns us the convolution and addition block.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;def convolve_and_add(x, translation_vector_reshaped, image_dim, num_filters=14):
    &quot;&quot;&quot;
    Defines the convolution and add block.
    :param x: Input tensor
    :param translation_vector_reshaped: Shape input reshaped as (1, 1, 14) tensor
    :param image_dim: The dimension of input tensor, assuming the
                      image hight and width are same
    :param num_filters: Number of filters in each convolution layer
    :return: Output tensor
    &quot;&quot;&quot;
    #Sun
    get_tiling_lambda = lambda: Lambda(lambda x: K.tile(x, [1, image_dim, image_dim, 1]))
    
    x = Conv2D(num_filters, (3, 3), activation=&apos;relu&apos;, padding=&apos;same&apos;)(x)
    translation_vector_tiled = get_tiling_lambda()(translation_vector_reshaped)
    x = Add()([x, translation_vector_tiled])
    x = Conv2D(num_filters, (3, 3), activation=&apos;relu&apos;, padding=&apos;same&apos;)(x)
    translation_vector_tiled = get_tiling_lambda()(translation_vector_reshaped)
    x = Add()([x, translation_vector_tiled])
    x = Conv2D(num_filters, (3, 3), activation=&apos;relu&apos;, padding=&apos;same&apos;)(x)
    translation_vector_tiled = get_tiling_lambda()(translation_vector_reshaped)
    x = Add()([x, translation_vector_tiled])
    x = BatchNormalization()(x)

    return x
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then we define decoder network using &lt;code&gt;convolve_and_add&lt;/code&gt; as,&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;def get_decoded(encoded, translation_vector):
    &quot;&quot;&quot;
    Defines the decoder network.
    :param encoded: Tensor representing the encoded image
    :param translation_vector: One-hot vector representing the translation amount
    :return: Decoded image
    &quot;&quot;&quot;
    translation_vector_reshaped = Reshape((1, 1, 14))(translation_vector)

    #### Block 1 ####
    # Convolution
    x = Conv2D(36, (3, 3), activation=&apos;relu&apos;, padding=&apos;same&apos;)(encoded)
    x = Conv2D(36, (3, 3), activation=&apos;relu&apos;, padding=&apos;same&apos;)(x)
    x = Conv2D(36, (3, 3), activation=&apos;relu&apos;, padding=&apos;same&apos;)(x)
    x = BatchNormalization()(x)
    # Upsample
    x = Conv2D(14, (3, 3), activation=&apos;relu&apos;, padding=&apos;same&apos;)(x)
    x = UpSampling2D((2, 2))(x)

    #### Block 2 ####
    # Convolve and Add
    x = convolve_and_add(x, translation_vector_reshaped, 4)
    # Upsample
    x = Conv2D(14, (3, 3), activation=&apos;relu&apos;, padding=&apos;same&apos;)(x)
    x = UpSampling2D((2, 2))(x)

    #### Block 3 ####
    # Convolve and Add
    x = convolve_and_add(x, translation_vector_reshaped, 8)
    # Upsample
    x = Conv2D(14, (3, 3), activation=&apos;relu&apos;, padding=&apos;same&apos;)(x)
    x = UpSampling2D((2, 2))(x)

    #### Block 4 ####
    # Convolve and Add
    x = convolve_and_add(x, translation_vector_reshaped, 16)
    # Upsample
    x = Conv2D(32, (3, 3), activation=&apos;relu&apos;)(x)
    x = UpSampling2D((2, 2))(x)

    #### Block 5 ####
    # Convolution
    x = Conv2D(32, (3, 3), activation=&apos;relu&apos;, padding=&apos;same&apos;)(x)
    x = Conv2D(32, (3, 3), activation=&apos;relu&apos;, padding=&apos;same&apos;)(x)
    x = Conv2D(32, (3, 3), activation=&apos;relu&apos;, padding=&apos;same&apos;)(x)

    decoded = Conv2D(1, (3, 3), activation=&apos;sigmoid&apos;, padding=&apos;same&apos;, name=&apos;last_conv&apos;)(x)

    return decoded
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This gives in surprisingly neat results.&lt;/p&gt;
&lt;p&gt;&amp;lt;figure&amp;gt;
&amp;lt;img style=&quot;width:80%&quot; src=&quot;/images/posts/transforms/mnist-translation-output.png&quot; /&amp;gt;
&amp;lt;figcaption&amp;gt;&amp;lt;b&amp;gt;Figure 6:&amp;lt;/b&amp;gt; Result of the autoencoder on translation task&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;&lt;/p&gt;
&lt;p&gt;Then I decided to repeat the experiment but this time trying to rotate the digits.&lt;/p&gt;
&lt;p&gt;&amp;lt;figure&amp;gt;
&amp;lt;img style=&quot;width:80%&quot; src=&quot;/images/posts/transforms/mnist-rotation-output.png&quot; /&amp;gt;
&amp;lt;figcaption&amp;gt;&amp;lt;b&amp;gt;Figure 7:&amp;lt;/b&amp;gt; Result of the autoencoder on rotation task&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;&lt;/p&gt;
&lt;p&gt;Then as a harder benchmark I tried to train it on Fashion-MNIST. On the translation task
we lose some details but it gets the outlines right for the most part. As our primary
objective was translation, I did not repeat the experiment on rotation task.&lt;/p&gt;
&lt;p&gt;&amp;lt;figure&amp;gt;
&amp;lt;img style=&quot;width:80%&quot; src=&quot;/images/posts/transforms/fmnist-translation-output.png&quot; /&amp;gt;
&amp;lt;figcaption&amp;gt;&amp;lt;b&amp;gt;Figure 8:&amp;lt;/b&amp;gt; Result of the autoencoder on Fashion-MNIST translation task&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;&lt;/p&gt;
&lt;p&gt;The Google Colab notebook for the MNIST translation task is available &lt;a href=&quot;https://colab.research.google.com/drive/1hvf6VssjzgJssax4OdNg1hlMhWj9tQc2&quot;&gt;here&lt;/a&gt;, where you
can &lt;a href=&quot;https://medium.com/deep-learning-turkey/google-colab-free-gpu-tutorial-e113627b9f5d&quot;&gt;train the network with cloud GPUs&lt;/a&gt;. Though,
ultimately I was unable to use the method on iris images, I thoroughly enjoyed performing these
experiments.&lt;/p&gt;
</content:encoded><author>Amey Agrawal</author></item></channel></rss>