Ruby API for GR Framework!!

GR Framework is a universal framework for cross-platform visualization applications. It offers developers a compact, portable and consistent graphics library for their programs. Applications range from publication quality 2D graphs to the representation of complex 3D scenes.

The above paragraph is directly picked up from GR Framework documentation and encapsulates the spirit of GR. You can read more about GR Framework here.

So far GR Framework is available for C, Python, and Julia.
For my GSoC 2018 project, I extended its support to Ruby using C Extensions.

Before we begin using it we first need to install it (duh).

the easiest way to install GR framework is to simply select your system configuration hereand following the process mentioned.
but instead of installing python-gr replace it with just gr.
(unless you also want GR Framework for Python)

This will install GR Framework in /usr . So we will create a symbolic link for the same by:

sudo ln -s /usr/gr /usr/local/gr 

You can also install using it via pre-built binaries but that does not install fonts for text and installing it from source leads to an X11 error. (Trust me I tried)

Now that you have GR Framework installed. You need to install the C extensions to use it with Ruby.

To do the same, you first need to clone my repo using:

git clone https://github.com/pgtgrly/GRruby-extension
cd GRruby-extension

Install the gems using:

gem install rspec ZenTest rspec-autotest hoe rake-compiler

Make sure that Your Rspec version is 3.x.
And compile it using:

rake compile

Congratulations you can now used GR Framework with Ruby!
Let’s take it for a test drive!
Whip out your terminal and make sure your working directory in GRruby-extensions.
Then write your Ruby code in a file (say hello_world.rb)

require "./lib/grruby.rb"
GR.setviewport(0.1, 0.95, 0.1, 0.95)
GR.setwindow(-10, 10, -10, 10)
GR.setspace(-0.5, 0.5, 0, 90)
GR.setmarkersize(1.0)
GR.setmarkertype(-1)
GR.setcharheight(0.012)
GR.settextalign(2, 0)
GR.settextfontprec(103, 0)
GR.setfillintstyle(1)
j=1;
while j<50;
  i=1
  x=[0]
  y=[0.25*(-1)**j]
  GR.axes(1, 1, 0.0, 0.0, 1, 1, 0.01)
  GR.updatews()
  while (i<10) do 
    x.insert(-1,x[-1]+1*(-1)**j)
    y.insert(-1,y[-1]*1.5)
    GR.setfillcolorind(10*j+i) 
    if x.size >2 and y.size >2
      GR.fillarea(x,y)
    end
    GR.polyline(x,y)
    GR.polymarker(x,y)
    sleep(0.5)
    GR.updatews()
    i+=1    
  end
  sleep(1)
  GR.clearws()
  j+=1
end
puts("done")
hold=gets

Save it and run it using Ruby interpreter.

ruby hello_world.rb

Your output would look something like:

GR.gif

Now Rejoice!!
I have tried to follow the Python GR API as an example and the same can be referenced.
There are more examples that can be found in the examples folder (I will be updating it with more examples soon, as well as change the API to reflect the dynamic Arrays that are not present in C).

Post Script: I have tested the above in a fresh Ubuntu-install and it is working fine, please let me know about any compilation issues in any other OS.

Using C Extensions for Ruby to create a Ruby wrapper around a C library

It is often the case when you are sipping your tea at the middle of the night. You are suddenly forced to readjust your fancy monocle because you just came across a highly optimised Library written in C. But alas, it is not yet available in Ruby, your favourite language.

You wait for weeks hoping that the developer would port it. But they are busy having a life. Then one day when you hear your “colleagues” ranting about how someone created a Python wrapper for it and that makes you lose it.

That night a thought dawns in your mind:

myself.gif

Since you love control you decide to tackle this at a fundamental level and create C extensions rather than using Fiddle/ffi. And hence you find yourself here.

The journey ahead is difficult yet interesting, when you go through it you will gain a lot of valuable insights about the Ruby Interpreter and get yourself a shiny Library that you can use.

You need to prepare well. There are a lot of brilliant sacred texts about creating C extensions that can be found here,here (both parts) and here

I would advise you to go through these before you continue reading this post.

Because in this post I will not be reiterating the entire procedure that has already been well explained in the referenced blog posts, rather I will develop upon the problems that I tackled while creating a Ruby wrapper around GR Framework

To write these extensions we use the Ruby.h (Ruby C API) to directly communicate with  theRuby Interpreter via C code using ruby.h.

Specifying the compilation flags

The first issue that I faced was configuring the extconf.rb file (which creates the makefile) to include the required compilation flags

To compile a C code which uses GR Framework  (lets say test.c) I need to pass the following:

gcc test.c -I/usr/local/gr/include -L/usr/local/gr/lib -lGR -lm -Wl,-rpath,/usr/local/gr/lib

Here the -I/usr/local/gr/include gives the location of the gr.h include file, while -L/usr/local/gr/lib -lGR -lm -Wl,-rpath,/usr/local/gr/lib points to the location of the .so (shared object file) the include file uses.

Hence we modify our extconf.rb file to include the flags:

require 'mkmf'
$CFLAGS << " -I/usr/local/gr/include "
$LDFLAGS << " -L/usr/local/gr/lib -lGR -lm -Wl,-rpath,/usr/local/gr/lib"
create_makefile('grruby/grruby')

Wrapping a C Library function in Ruby

Now lets say that we have to create an extension for a C function with the following declaration.

void gr_axes(double x_tick, double y_tick, double x_org, double y_org, int major_x, int major_y, double tick_size)

The extension will look like :

#include "gr.h"
#include "ruby.h"

static VALUE axes(VALUE self, VALUE x_tick, VALUE y_tick, VALUE x_org, VALUE y_org, VALUE major_x, VALUE major_y, VALUE tick_size){

double x_tickc=NUM2DBL(x_tick);
double y_tickc=NUM2DBL(y_tick);
double x_orgc=NUM2DBL(x_org);
double y_orgc=NUM2DBL(y_org);
int major_xc=NUM2INT(major_x);
int major_yc=NUM2INT(major_y);
double tick_sizec=NUM2DBL(tick_size);
gr_axes(x_tickc,y_tickc,x_orgc,y_orgc,major_xc,major_yc,tick_sizec);
return Qtrue;
}

void Init_grruby(){
VALUE mGRruby=rb_define_module("GRruby");
rb_define_singleton_method(mGRruby,"axes",axes,7);
}

Let us look into the function that we have wrapped

static VALUE axes(VALUE self, VALUE x_tick, VALUE y_tick, VALUE x_org, VALUE y_org, VALUE major_x, VALUE major_y, VALUE tick_size){

double x_tickc=NUM2DBL(x_tick);
double y_tickc=NUM2DBL(y_tick);
double x_orgc=NUM2DBL(x_org);
double y_orgc=NUM2DBL(y_org);
int major_xc=NUM2INT(major_x);
int major_yc=NUM2INT(major_y);
double tick_sizec=NUM2DBL(tick_size);
gr_axes(x_tickc,y_tickc,x_orgc,y_orgc,major_xc,major_yc,tick_sizec);
return Qtrue;
}

The function “axes” is going to get its parameters from Ruby.

The Ruby Values need to be parsed into double and int C values so that they can be passed to the C function.

Lucky for us ruby.h provides us with a lot of methods ( This post is really helpful) like NUM2DBL (You can use RFLOAT_VALUE() too but that can cause the interpreter to crash if non float values are passed) and NUM2INT that we can use.

After which we can create the C counterparts of the Ruby values and pass them to the C function.

Since the wrapped C function returns nothing we return an arbitrary Ruby value (Qtrue in this case, which is boolean true for Ruby) as a Ruby function needs to return something.

I would suggest that you look into the C extensions code for Arrayfire  and fast_blank for example code.

In the upcoming post, I will discuss parsing and passing Ruby arrays and strings to a C program and how to make certain C functions more “Rubylike”.

Google Summer of Code 2018: Chapter 1: The One Constant in Life

 

Before you move any further, make sure that you have read the preceding post here.

 

There is a single constant in life and that constant is change.

It has been 14 days since the Summer of code Programme commenced and my project has changed considerably.

Initially, I planned to create a plotting library from the scratch. We divided the plotting project into two sub-projects. A dynamic plotting library that was written in pure Ruby and a static plotting library whose backend layer would be written in C++, I chose the latter.

Upon a lot of discussion with the community, I decided to start creating the backend in GR Framework, which is an excellent plotting library, still in early stages of its development. And since it is in the early stages, I was not able to find a lot of examples for the same.

So in the interest of time, I decided to start creating the backend with Cairo as a renderer (which was a renderer that I was familiar with), while I explored GR Framework.

GR framework turned out to be a fully fledged plotting library than a Raster graphic renderer, using it as a framework would be similar to using matplotlib as a renderer.

Upon discussion with my mentors and email exchanges with the developer of GR Framework, I realized that GR framework is the cross-language library that I was striving to create.

So we decided that my project would be to extend the C API of GR framework to Ruby. This meant that I would have to ditch weeks of my research and start anew, but I guess that is the kind of adaptability that I can expect in real-world projects. I had to gain my footing fast and quick.

I quickly went through a lot of online resources about creating a Ruby wrapper for a C library.  There were 3 options:

  1. Ruby Inline
  2. Fiddle/FFI
  3. C extensions

Ruby Inline seemed to be a good option to have a small C module in a Ruby code but did not seem feasible to create a wrapper.

Fiddle and FFI are packages in Ruby to create Ruby wrappers around C code. Although FFI has been in use for a longer time, Fiddle is a module from the standard library of Ruby, whereas FFI is an external module

Work with Fiddle  hit a dead end because of the lack of online examples and sparse documentation. So I started working with FFI which was well documented, but certain examples in my code caused the interpreter to crash. I needed to work with the Ruby Interpreter on a more fundamental level.

So with the valuable advice of my mentors, I finally decided to create C Extensions to GR Framework.

The details to the same are discussed in this blog post which I have written in a generalized way so that it can be relevant to someone looking for help with C extensions in the future.

You can expect the next blog post to drop around 10 June 2018.

 

Google Summer of Code 2018: A Preface

What is my Project?

I will be creating a Plotting library inspired by Matplotlib in a language independent format which can easily be bridged to any language.

My Journey till now

Before GSoC I have worked extensively on implementing various end to end deep learning pipelines using low level Python frameworks.

I came across the project while I was browsing through the ideas list.

Being a long term user of Matplotlib I was intrigued by the idea of creating a language independent Plotting library.

I decided to implement a basic Line plot script in C++. Initially, I planned on using AGG but due to the lack of documentation (because of the untimely demise of the author), I shifted to Cairo graphics and created a quick prototype .

As per the rules I had to contribute to Sciruby for my application to be considered I had to contribute to the organization. After looking into various open issues in various projects under the organization. I came across request for feature that I felt I could implement. And I did the same in my commit. As someone who had not worked with Ruby before , this was my first encounter with Ruby. I also learned the importance of test driven development for software meant for distribution as well as squashing commits in Git for the sake of readability and easy debugging.

At this point this was all I could do. So I dived into the source code of Matplotlib and gained valuable insight from it.

Why SciRuby?

I will reiterate my answer which I wrote in my proposal (which can be found here ):

I haven’t had an experience with Ruby so I cannot comment on that.However, the reason that I applied for SciRuby is strongly founded. The following is an excerpt from the History section of NumPy’s Wikipedia page:

The Python programming language was not initially designed for numerical computing, but attracted the attention of the scientific and engineering community early on, so that a special interest group called matrix-sig was founded in 1995 with the aim of defining an array computing package.

This led to the creation of two Libraries namely Numeric and Numarray, which were later combined into NumPy. The brilliance and simplicity of NumPy was later complemented with MatPlotlib, which to my limited knowledge, provided the very base for development of Python as a scientific language.

I feel something very similar with SciRuby. With a proper Linear Algebra Library such as NMatrix which when complemented a Plotting Library can give the basic tools to researchers to adapt and utilize the language according to their needs.
However, I am more intrigued by the prospect of a cross-language implementation of a plotting library. Albeit, it will be a challenging task. it will lead to the creation of a fundamental piece of scientific software that can be used to turn any language into a scientific computation language.

Why the Project?

The primary reason that I want to participate in GSoC is to learn Open Source Software (OSS) Development. And there is not better way to learn than by hands on work. The reason why I am excited about the project is that it has the potential to act as a plotting library for any language and would thus be open in a new sense.

Matplotlib Architecture

The Matplotlib Architecture is be broadly divided into three layers (as shown in the masterpiece of a figure which I made below). The Backend, The Artist and the scripting layer.

The Backend layer can further be divided into three parts : The Figure Canvas, The Renderer and the Event.

Matplotlib architecture is mostly written in Python with some of its backend (the renderer AGG and Figure canvas ) written in C++ ( The original AGG backend and helper scripts, which is quite tightly bound to python). But the recently the backends are also written in Python using the renderers which have Python APIs.

Matplolib

Matplotlib architecture

The finer details about Matplotlib architecture can be found in an utterly brilliant post here .
As of the time of writing the post, Me and my mentors are discussing over the details of implementation and considering the possibility to prototype it in Ruby first. The discussion can be found here.

What now?

I will be posting about my project every weekend here under the tag GSoC2018 . And what my posts will do the best (as a Dalek would say) is:

Dalek.gif

Expect the future posts to be much more technical (compared to this one).

On a serious note the project is not going to be easy. The ground work that I have to do includes (but is not limited to):

  • Throughly understanding the Matplotlib Architecture
  • Revising C++ STL and features in the latest standard
  • Familiarising myself with libraries such as ImageMagick,Qt and Armadillo
  • Learning the art of discipline

Is it going to take all I got? Yes.

Will I learn a lot? Yes.

What do I really feel like? Well ….

hobbit.gif

 

The journey continues here.

Live Blog: Training an Object Detection Faster R-CNN from The Scratch

I am training a Faster R-CNN Tensorflow API to detect windmills from satellite images as part of my Summer internship, wherein I created my own dataset from scraping the web

Proper and expansive details about the project will be given in subsequent blog posts.

Real men train their neural networks from scratch rather than transfer learning . Real men use Xavier’s initialisation (Though I am not sure if this API does so :P). Anyways I decided to train an image detection model on my custom tiny dataset for satellite images of windmills my summer project from the scratch. It is interesting how the detector evolves and become more refine in the more latest iterations. It is funny how you can observe the CNN filters figure out the low level features which you can deduce from certain observations. When I got the Idea of writing this post I had already trained my classifier 18592 steps with several check points on the way, I will post them first and keep updating as I move along. I think I will stop at a mere 50000 iterations which will span over a week or so on Nvidia GTX 1060 as I have other stuff to do with my Laptop too.

There was another framework named Tensorbox which was run on RRSC-W’s server machine with Nvidia Quadro K2200 and transfer learning and was able to go through 250000 iterations in one night, I do not know how (O_O). We will see compare the final results with it in the end.

 

Let me give you a taste of our dataset:

The dataset are satellite images

 

 

We had 1288 images out of which we annotated 455 and used 226 images for training.

(WARNING: TRAINING DEEP NETWORKS WITH SMALL DATASETS WITHOUT TRANSFER LEARNING CAN LEAD TO OVERFITTING)

Which was crudely annotated by us to like:

 

with annotated bounding boxes stored in xml files.

We are actually detecting windmills shadows here. I will use the term windmill and windmill shadow interchangeably unless explicitly specified..

these are the images on which we will test our model:

 

The first and the third images are zoomed out images of an area where out test set is taken from although not the same windmills. ( DO NOT do this in commercial practice).

The second image is one of the images from our validation set.

The fourth and the final image is an image from a totally different area (in Finland) with background being green ( because of trees and grass) unlike outr dataset which is black and grey and brown. This image is given here to see how much does the background colour affect the detection. In the already complete Tensorbox version of our project we found out that it does not matter.

 

Results after various iterations:

  • After iteration 7982

 

 

This is barely a detector right now as you can see that the detector is not able to detect windmills in a zoomed out image. This might be because the Region proposal network (RPN) are not trained properly yet. This can also be attributed to the fact that the classifier is less than 50% sure about the object.

  • After iteration 12008

 

 

Image 1,2,3 : It seems like the RPN is getting better. But wait! Why are there so many boxes? RPN proposes different regions and then they are sent to classifier to tell whether it is a windmill or not. There can be various region proposals containing the same object and this is why we use something called as Non maximum suppression (NMS) (Thanks Sethu Iyer for pointing it out!) most used type of  NMS is basically a greedy algorithm that greedily selects high scoring detections and deletes close-by less confident neighbours since they are likely to cover the same object. Our NMS should get better as classification gets more accurate

Image 4: This is where things get exciting, The network is detecting a part of image 4 as windmill but not the actual windmills 😥 . We can however see that the part which is detected is much like the shadow of windmill, but white. this might be because Gabor functions in low level filters and the subsequent  who only concerned about the edges and pole like features rather than the colors.

  • After iteration 13751

 

 

 

There are zero (nil, nada, zephyr, shunya) changes from 12008.

  • After iteration 15894

 

 

Image 1. Seems like Both Classifier and the RPN has improved. also I am getting a single region proposal for a given object. also both the windmills are detected 🙂

Image 2: This seems like an overkill, way too many region proposals. Atleast it is detecting the windmill. however there is also a region proposal with vast empty space.

Image 3: I see that the Proposal region has improved quite a bit

Image 4: seems like the low-level colour filters have overtaken the  low level Gabor functions

  • After iteration 18592

 

Image 1: We can see that the classifier has improved its accuracy, its surety has improved.

Image 2: Better region proposals can be observed.

Image 3: more classifier accuracy.

Image 4: A bit confused over here, 2 out of the 3 region proposals do not take the windmill into account. The one which does has a huge Proposal region on which the actual windmill is at an upper corner.

  • Loss Graphs (till step 18592)box classifier loss mul 3_1loss box 4_1loss rpn 2_1loss rpn 3_1total loss

 

Note: In this post specifically in the data collection and the project part, I is referring to my team compromising of  Ashutosh Purohit, Vidhan Jolly and me (Pranav Garg)

I will soon update this post with my observations on various iterations.

This post will be updated with new results at iteration 22000, Which might take some time because:

I have a dual booted Laptop with GTX – 1060 and I am working on a lot of projects. my windmill detection problem statement has been completed on RRSC-W’s machine using Tensorbox ( with some pretty accurate and surprising results). However I will train this network whenever my machine is free. The Training also needs some supervision as I get an error that the loss tensor is NaN ( maybe someone forgot to add a small number to the softmax causing this error) and needs to be restarted when this error occurs.

 

If I forgot to add something or made an error, or if you have a suggestion please mail it to me at pranavgarg@gmail.com

Edit: This Live Blog has been shelved because of a possiblity of publication,which I will update here when it happens.

 

Edit

Photographs

The following is the excerpt (relevent to the purposes of official report) of the transcript from the authorised emergency interaction session on 19 December 1986, 1900 hours in confinement chamber 42-B between the esteemed Chairman of the Department of Science and Physiology and the honoured subject 7AH under observation in the facility:

“I heard you come in, they told me that you will be the one personally hearing me out, if it was under better circumstances I would have given you a warm welcome”

“I had to come here myself for the pride of our nation. I must tell you, it pains me to see you in such position.But let us not waste any time and please brief me about your stay here, and the disease you are suffering from”

“ Straight to the point,eh? You will find that my case is that of misunderstanding and helplessness”

“I would request that you be more specific about it”

“Sure, Let me tell you all about it. I have rehearsed it all.You ever seen a photograph?”

Photographs. They are the frames that capture the happening of the moment for eternity, When we see the world around us passing by, what we see is a batch of photographs taken by our eyes in continuation and streamed through our brain to detect.

“It takes around 16 ms for neurons in the visual cortex to begin to recognize and categorize a newly appearing visual input”,

I will put this in Layman terms for you: after every 16 milliseconds our brain takes a new photograph which is continuously provided by our eyes and puts them together to see how the world is changing. It is something which we take for granted, let me rephrase it; it is something that you, my dear arbitrator take for granted. I used to do that too.

One of the ailments that haunts me is a very peculiar one.

“The MT5 region of your brain seems to have rewired itself to form a recursive network of neurons which keeps on sending the same stimulus to the neurons, and judging by the progression of your condition it seems like it is trying to disregard the external new stimulus provided by your eyes. Currently it seems to do that for random time periods throughout the day. I am afraid that your condition is going to exponentially worsen over time both in case of duration and severity”

Instead of continuous fast paced images in form of a video. I see discrete photos that are stuck in my mind over time and the time for which it is stuck in my head is increasing and increasing fast.

Let me give you an example, at the initial phases of my ailment, When I poured tea in a cup, I saw the part when I began pouring and the part that I overfilled the cup after 5 seconds, but not the part where the cup was being filled.

But it isn’t like this happened to me all the time at the beginning, I had normal vision for most of the time but then suddenly for lets say 5 minutes my brain sees images every 5 seconds instead of every 16 ms and after those 5 minutes are done it goes back to seeing the proper video. My shrinks started calling these incidents as “Vision-Attacks”. This however was my condition when I was in a relatively better place than now, I think that is pretty visible . The problem is that the vision attacks occurred randomly and their duration was increasing every time they occur. If that wasn’t enough, the time between continuous pictures taken by my brain during these attacks was also increasing with each attack.

At this point however I feel like I should begin with the inception of it all, of course, I will be skipping my role in the war and the atrocities that I committed, the documents are going to be declassified after my death and I am going to be posthumously court-marshalled and disgraced anyways, I would rather delay the inevitable. That was always the plan. If you would however like a better explanation about the phantoms haunting me, I would urge you to go through any and every document released by our “gilded” leaders that remotely mentions me or the quote “Spero in Mortem”.

However what I will admit to  is that I was at the epicentre of the horrific incident that led to the end of the entire conflict, the infamous bunker incident which is shrouded in mystery. I miraculously survived, was decommissioned after that incident and  after being celebrated as a hero by my superiors who plan to stone my reputation when I am no longer alive, I was given my service uniform as a memento to bring back. Oh , I wish that it was the only thing that I brought back.

“ Your condition seems to be result of multiple head traumas, exposure to nerve gas and radiation, we cannot be sure. Like I said before , it is only going to worsen”

I started seeing the symptoms of my vision defect about a fortnight after returning back home. Instead of sending me back to civilian life I was put in care of the nations best facility for Psychology and Neuroscience , they say that they did this because they want to make sure that I am healthy enough to live a normal life, they had to do this after all I had gone through, it is like they had a premonition that there is something wrong with me.

But with all that being said, they had provided me with a nice living space on campus of the institute, an apartment of my own in the block where the campus residents live, that is the least they could have done for me. On one hand I was glad that I was under supervision, The dusking days of the conflict left me with permanent mental scars which occasionally surfaced in form of sleep paralysis and PTSD triggered panic attacks. I was convinced that I will overcome that soon and be a civilian again. On the other, I often thought that they want to experiment on me, squeeze out everything I have, for this nation of theirs. I tried to suppress the latter for the most part.

After around a week in the facility and multiple nervous breakdowns, I was feeling a lot better, All the time with the shrinks, (well technically they can be classified into Neuroscientists, Psychiatrists and Psychologists but I am going to refer them all as shrinks) seemed to have paid off. Their names of course, do not matter as they seemed to change in a constant flux. Frankly I was very relived with this arrangement, I never wanted to be completely vulnerable to a single person ever again, However deep down I know that they kept a well documented record of me which these shrinks might look at and giggle whenever I had an appointment. I tried not to think about it, the thought that  there exists something written that justifies your entire existence is not another burden I wanted to add to the heap.

A heathen propagandist once said, “ Desires are root cause to all the suffering”. Maybe I suffered because I desired, Desired to roam around as a common man, free to weave his own strings of destiny. But I was already bound to the chain that I had woven one lock at a time throughout the war.

As I was saying before, A week into the facility and I had already starting feeling better, it might be because of the fact that every morning I had to take a cocktail of pills, or the fact that I started to understand my behaviour in a much fundamental level or maybe it was because I spent most of my time trying to figure out the correct paths in this labyrinth that was mistaken for a treatment facility. I was given an introductory session that spanned the entire first week, wherein I was told what will happen to me in this facility along with the precious information that I will be put under re-evaluation at the end of the four weeks to see if I am healthy enough. The session was coupled with a lot of medical tests, they made the days pass quickly.

Based on the results and shrink’s observation, I was allotted a dynamic schedule that I had to follow for my well-being which was dropped at my door every morning at 5:30 am.

“I will find someone truly special and worthy for me.”

“I have noticed that you specifically emphasized on worthy, I have seen your record, you claimed that you had no prior romantic relations or interests before the war. Did you find someone whom you deemed unworthy during the war?”

“I might have, but I would rather not talk about it, I had to take some decisions that I prefer not to think about”

“One last question, why do you deem her to be unworthy for you?”

“I think you already know what makes a person unworthy to live, I cannot say anything more, the whole context is classified”

“Of course, I just did not expect that a decorated hero of the people like you would make this kind of mistake. Pardon my ignorance . Moving on…”

At the beginning of the second week, they cut open a wound that wasn’t fully healed yet , They forced me to think about what I did to her, of course I was quick to avoid it, I cannot talk about it even if I wanted to, anything except the existence of the bunker incident is classified. Even the mention of the incident is taxing to me. So I did what I always do, Bury the emotions deep beneath the field of my mind.

Week 2 also marked the inception of daily (except weekends) physical activity upon my request which usually spanned for two hours from 6 am to 8 am. The exercise routine was an hour of running followed by an hour of body weight training and yoga.

Unlike other role bearers allotted to me, my physical trainer, the retired drill sergeant, Aldalbert “Bertie” Müller was the constant in my entire duration of stay. Birds of same feather flock together, I connected with him within our first four sessions, unlike most people he wasn’t dazzled to meet me for the first time, which was nice for a change of pace. I got to know that he retired from his duty about 5 years ago and was occasionally paid to come over to the facility for certain patients, important ones, he mentioned. He wasn’t allowed to share their details but he assured me that the facility has treated them of any ailments that they might possess and some of them are still in contact with him. I could understand why. He was the only constant in this institute that is in constant flux. Only friendly face in the crowd.

I had never felt so rejuvenated ever since my childhood, after a long time in my life I felt like I am in charge and I can mould myself in any fashion that I want to. This epiphany came to me when I was attending the Sunday evening service that Adalbert forced me to go to. After years of distancing myself from our true lord, I finally found it in myself to pray for serenity and thank him that the worst phase of my life is over. God must be a sadist.

On the Monday of the third week I woke up as usual after hearing a series of raps on my door at 5:30 am. For some reason I had a splitting headache, which I tried to gulp down along with an aspirin, after reviewing the day’s schedule and finishing my daily ritual, I navigated my way to the central grounds. Bertie was already there waiting for me in his camo print track-suit.

“Ready for the run, Sergeant!” I exclaimed

“Ha ha, not today soldier, Today I planned out the gentlemen’s sport for us.”

“Boxing?”

“Of course not, does this ground look like gym to you? Today we will have a hand to hand combat drill, sport of the true gentlemen. It is going to be easy for you, it has been 6 years since I last did this“

“I thought you retired 5 years ago”

“Yeah the last year things got more practical because of the war, you ought to know that”

“Lets not talk about it”

Surprisingly close ranged combat was more useful to me during war than gun slinging, well that might be because of the tactical nature of my specific work.

I almost felt that Bertie was lying to me about being out of practice, I was barely able to keep up with his blows to parry them, then I decided to go offensive and landed a cross jab right on his chiselled jaw. He staggered back a foot and then cocked back his arm to build momentum, and then he froze. That is the moment I can pin point everything to.

That is when it first happened.

I felt a ringing pain on my temple and a sudden feeling that I am falling .But the Sergeant was still there ,I could see him, standing in front of me ,frozen, with his hand clenched in a fist next to his ear.

Next thing I knew was that I felt a strong impact at the back of my head and suddenly the scene shifted and I saw blue with some specks of white, I was staring at the sky, I had fallen like Goliath and the punch was my pebble. The entire fiasco took place in 2 seconds. I sat on the ground right after I got to realise what was going on.

“ Son” I heard an echo. As the ringing faded, it became more clear

“Son are you alright?”

“Yes Bert”

“What happened there? I thought you would block that”

“Brain fart, I think it is enough for today, I need to go now” I replied trying to cover up this surreal experience,

“But we still have your muscles and Chakras to work on”

“Not today Sergeant, not today”

I discussed the incident with my flavour of the day shrink and he said that it might have been caused because of misfires in my brain. He said that it was insignificant but asked me to report it if it happens again. The rest of the day was very mundane, my routine went as usual, I talked more about my feelings, went through several tests, rehabilitation exercises from the drones ( the nursing staff), you know, the same old routine.

The next day, that is Tuesday of the third week saw one more such incident, this one happened in the morning when I was taking the breakfast. Remember how I talked about pouring tea? That happened to me. Empty cup. Overflown cup. Slightly burnt hand.

This time I reported it with a tone of urgency which was again followed by more tests and a conclusion that they will open my skull and observe it on Thursday. They also nicknamed these moments as vision attacks.

On Wednesday I spent 10 minutes watching a series of pictures changing every 2 minutes with continuous audio on television and 7 minutes staring at a still fan that changed its orientation suddenly while I experienced its cooling effect on my face.

On Thursday, I was sedated early in the morning for brain activity observation. The entire procedure was supposed to go on for 10 hours.

“We will open your skull , look at specific parts of your brain , give different stimuli to your eyes while you are unconscious and observe the changes. You are very likely to  get these vision attacks over this time period, if not then the time period might be extended.”

I regained consciousness by 7 pm and was soon greeted with dinner on my ward bed, One of the drones told me that the operation was over by 5 pm and what they found out was pretty interesting and I will be briefed about it as soon as the shrinks made sense out of it . I had to spend night in the observation ward so that I can be treated in case of any complications. The dinner tasted kind of funny, I was assured that it was one of the side effects of the anaesthesia.

For some reason I felt extremely exhausted after my dinner so I dozed off into a deep sleep by 8 pm.

One of the things that war has made me despise is sleeping, I was never able to dream and today was no exception, the real horror starts when I am about to wake up, because sometimes I experience sleep paralysis, A state when my mind is semi-conscious but my body is in a state which is quite similar to rigor mortis. I am not able to move at all, this is usually accompanied by hallucinations, Oddly this was the first time I am experiencing it ever since I came to the facility. As usual, I saw a silhouette of a woman staring at me along with an uneasy pressure on my chest. At this point I was very much accustomed to her standing there and judging me . Maybe it is karma, After all  I killed her in the bunker incident. I killed my love. However, seeing her always brought something more than dread, it brought a flood of emotions and heartache that no amount of therapy will ever make me used to. So I followed the drill and tried to push myself out of paralysis, after a few attempt to flutter my legs in the air I was able to do so, At this point the mind fully awakens ,the pressure on chest is relieved and the hallucinations seep away . However it did not happen this time, I realised that I had a vision attack in my sleep, the silhouette was still there. So I swatted the air where the mirage is supposed to be standing just for the sake of confirmation, I hit nothing there, I waited for the scene to shift and it shifted soon enough, the spectre haunting my mind was gone .But the vision attack still persisted ,  I saw quick bright flashes of something which seemed like a face  and saw the dimly lit ward again, empty, with the bright LED clock stuck in time, flashing 0542. I could hear heavy breathing, but there was no one in my vision. The flashes had never occurred to me before. And the breathing I heard was macabre in fashion and unnatural, maybe my ears are ringing, maybe it was the side effect of the surgery. But panic got the better of me.  I screamed for assistance and heard hurried footsteps rushing towards me that is when the next picture can to my mind, I was a blur moving towards the exit and a nurse entering form the other side. Then the picture of a visage flashed in my mind again and my vision was back to normal, the attack was over. The room was lit up, apparently the nurse had turned the lights on, I was the only one in the entire ward with the nurse being an exception.

I was too anxious at the time to think properly, I screamed at the nurse, thinking it was some sort of elaborate prank, I screamed at top of my lungs. I heard more footsteps coming towards my ward, The orderlies were here. The nurse requested me to calm down and tell her what happened. But I was paranoid , those flashes cannot be a co-incidence. So I went for the throat.

“WHAT IS GOING ON?WHAT ARE YOU DOING TO ME?”

That was the first time I realised that maybe I was going mad. I wanted to keep squeezing her neck until I got any answers. But I wasn’t able to do so, my grip loosened as I felt a sharp jab on my shoulders, I was sedated by one of the orderlies.

“The MT5 region of your brain seems to have rewired itself to form a recursive network of neurons which keeps on sending the same stimulus to the neurons, and judging by the progression of your condition it seems like it is trying to disregard the external new stimulus provided by your eyes. Currently it seems to do that for random time periods throughout the day. I am afraid that your condition is going to exponentially worsen over time both in case of duration and severity”

“I think it is pretty severe already”

“Theoretically there might come a time when you will be seeing one image for your entire life”

“Any Idea why this is happening, if you know the root of this maybe you can cure it”

“ Your condition seems to be result of multiple head traumas, exposure to nerve gas and radiation, we cannot be sure. Like I said before , it is only going to worsen”

This was the exchange that I had when I was woken up in constraints on Friday night, one of the shrink stayed behind to personally inform me about my condition. I convinced him to stay there in case I feel the presence of the spectre haunting me or see the flashes.

I did not suffer from any vision attacks that night, But there were many flashes of the visage throughout my sleepless night. I talked to the shrink about it and he told me not to think much of it as they surely are the after effects of the surgery. After seeing my calm demeanour he gracefully had my constraints removed.

 

“And that brings us here, to Monday of the fourth week, when you get to decide if I am fit enough to leave this facility. I think they called you in early to show you how hopeless my case is. I  urge you, I beg you , if you have any humanity in your heart, that you recommend me for the Euthanasia programme. I know that comes under your supervision too.”

 

“Hold on, you skipped Saturday and Sunday, and please explain what happened to your face”

 

“I am supposed to be the blind one here, Can’t you see that I clawed my eyes out? And do not avoid my request for Euthanasia, I am dead serious about it. You give it to people who do not want it all the time”

 

“Please do not throw dirt at the inner workings of my department. I can and I must tell you already, it seems like you are not in a condition to get out of here. Humour me, tell me  why would you claw out your eyes? Maybe if you tell me an entertaining tale I might consider you for the programme ”

“ Ah, there is the sadist that everyone talks about. Fine I will tell you what happened on Saturday and Sunday”

I woke up at 6 pm on Saturday evening, I rang the bell to call the nurse, but no one replied, There was pin drop silence as far as I could hear, All I heard was buzzing of the tube light, I somehow managed my way out of the ward through my legs which felt wobbly, maybe because of all the sedatives I had been given.

I had barely made it past door of the observation ward into the hallway and the second last vision attack occurred , A blank hallway was stuck in my mind but I could feel the corrosive heavy breathing nearby, I curled into a ball and closed my eyes waiting for the sound to go away. I shivered with fright, After all I have seen in war this was the worst experience I had ever traversed. After around half an hour, my vision changed, it was pitch black, A few minutes of darkness and the satanic noise vanished, but the attack was still in  motion. I was stuck in pure blackness till it ended or till the image shifted. I decided to crawl to the door at the end of the hallway which I was seeing for the last 30 minutes. I somehow managed to make it to the end of the hall and opened the door, The attack subsided and I was in the open again. I decided that I needed to go back to my apartment and call your department. I sensed that something wrong was going on here. It seemed like the entire campus staff , around 250 people were assimilated near my living quarters , the building was on fire. That is when the final attack occurred , I saw the flashes of visage again, but it stabilised, The face that I saw in all the flashes became clear, I is the face of the spectre that haunts me. or at least what this institute wants me to think that haunts me.

“That does not explained the clawed out eyes”

“What do you do when you see something so despicable that you cannot bear to see it, you close your eyes, I closed them, nothing happened I can still see the face clear as the day, In fit of panic I clawed them out in middle of the crowd and still  nothing happened, The image of my haunt was permanently stored in my mind , and I am doomed to see it till eternity or until this vision attack ends, which again might be an eternity, The institute thinks I have gone insane ,well that is what they tell me and that is why I am confined in this padded cell, Want to guess whose face I am staring at?”

 “Sophia?”

“Hah, so I was correct, You knowing her name is an indication enough that you all are in this together, her existence is a closely guarded secret. You all planned this together didn’t you, I am just one of your experiments now”

“You mentioned her name in your testimony right now”

 

“No I did not! I spent the time from which I was confined here: the entire Sunday, rehearsing what happened to me, just to get to know if you all are involved in this together or not. I was suspicious from the beginning. I wasn’t brought here to be treated, I was brought here to be experimented on, those drug cocktails, those tests, those hypnotherapy sessions, that is when you conducted your experiments on me,right? Those Vision attacks are your manifestations , And that operation to check my brain, that was just to plant Lea’s image in my head,right? I recognise that image now, it was the image on her military Identification. Do you know how difficult it is for me to keep up this calm demeanour when I have her staring at me in my mind?”

 

“Military Identification of a traitor, you seem to be very clever, maybe that is why you are a war hero”

 

“ Is this what you do to your heroes? Turn them into lab rats? I even sacrificed her for this nation. After all that I just wanted to go back to live a quiet life and repent her death. ”

 

“ You pledged you life to the nation. Didn’t you?  You are a very sensitive asset that we cannot risk letting loose in public. You should be grateful that we did not shoot you down after your debriefing. The Leader is very open hearted in his ways.”

 

“You are all bastards, you are all inhumane bastards, You even got a fake spectre to haunt me”

 

“It is ironic that you are calling us inhumane, As for the spectre I have no idea what you are talking about, you might be hallucinating”

 

“Stop it, stop toying with me, stop with all the lying. I know that she is in this room I can still hear her breathing.Let me die please, I cannot see her face any longer, I cannot bear the guilt.”

 

“I think we are done here. Your motherland thanks for your service again soldier as a reward to your services you will be rewarded with death today evening. Dr Müller ,thank you for the supervising the entire programme, it seems like out procedure is a success . I will put in a good word for you at the high command, Please make sure that you do the necessary, harvest the required. I will be needing some quarters for a short nap, After which you will brief me about the discoveries. Also arranged a secure line for me to the capital. We have some damning documents to released.”

 

 

The session ended at 2114 hours. The subject 7AH was moved to the cleansing facility for sterilisation at 2134 hours. The interaction of results between the esteemed Chairman of the Department of Science and Physiology and the honoured Facility Director  can be found in file 7AH8D.

Hello World.

“The journey of thousand miles begins with a single step”

The above-mentioned is the quote that inspires and reroutes anyone with a humongous task on hand. This is the first step ,the first post of many to follow.

I have been struggling for hours to come up with a name for my blog which was relevant to me (and of course, not taken by other bloggers). After a lot of introspection and vacillating around, I came up with “The Silent Monk’s Retreat”. A silent monk, though calm and in peace on the surface of his shell, might have the most brilliant of thoughts and ideas. It takes no genius to see that I am using the silent monk as a metaphor to my existence. And this here, is my retreat, my mountain to shout at. The genre of posts here will vary a lot, be it technical, philosophical, inspirational or personal opinions, struggles and developments or be it short and long stories. I will write it all

Now who am I?

Fun fact about the quote at the beginning of this post, It is a vague westernised translation of a quote by Lao Tzu or Laozi (The author of ” The art of war”) . Now Lao Tzu is just a  pen name  which roughly translates to “old master”. I ask myself this question: Should I follow his lead and stay masked ; behind a psuedo-name?  I think not, I believe that if you have the bravado to express your thoughts then you must possess the guts to be the face.

My name is Pranav Garg, I am (as in May of 2017) a  second year undergraduate student who is pursuing his Bachelors in Electrical and Electronics Engineering  from Birla Institute of Technology and Sciences, K.K. Birla Goa campus.

When it comes to academia ,I am very passionate about artificial intelligence and currently obsessed with deep learning. I dream of making significant contributions to Artificial General intelligence some day. My journey began with one of the most revered and fundamental course in Machine learning by Professor Andrew NG on Coursera , and then it led to Artificial intelligence where I am learning about many diverse but connected field such as Machine learning, Computer vision, Neuroscience (theoretical and cognitive) and much more.

Curiosity has always been the driving force for me, when I come across a problem I leave no stone unturned. I am an avid gamer (A huge Legend of Zelda fan)  and an ardent writer (as you are going to witness).

An interesting human life can never be expressed in just a few lines, and if it is possible to express it in a few lines then it is just not interesting. So instead taking the impossible task of expressing my existence through just my observations and words, I will let you walk in my shoes and see through my perspective via my posts.

Though I try to express myself to my limit everyday, a lot of what I want to express remains unspoken. So between what I want to express and whats expressed by me, I am relatively silent and distant.This here is my blog, my abyss to shout at .This here is my retreat. And this post is my first step in a thousand mile journey.