Saturday, April 28, 2012

International Space Apps Challenge - backing NASA

Last week I had the chance to participate in the inaugural NASA Space apps challenge, modelled after the random hacks of kindness which we see taking place whenever there are large natural disasters(earthquake in Hawaii) or to address malignant global social issues such as inequality and poverty. It is amazing to see the drive people at such events have to work on something that does not directly impact their everyday life.

Space exploration is one such outside context problem. It seems frivolous on first sight till we study a bit of history. Our current global economy is based on the last 500 years of exploration (and should I say colonial exploitation). The rules of economics are framed such that they require constant expansion of resources - raw materials, energy and ideas. Being in a closed system on the planet poses inherent limits to the amount of expansion we can achieve, in a similar way industrial revolution was bound by the border of colonial powers in Europe - they were forced to explore new worlds. Since the Earth is nearly fully discovered now and everyone agrees on very limited amount of exploitation being the norm, to achieve the growth our mindsets demand we need to expand beyond Earth - ergo space exploration and asteroid mining. By participating the the space apps challenge, we are taking a very small step towards pushing the material and energy exploitation off planet and relieving the pressure put on our bio-sphere and humans in highly populated countries by blind greed.



Philosophy and sociology aside, we worked on a very broad problem for the challenge - developing a Semantic Data Descriptor for NASA data holdings. NASA has a lot of past, present and planned missions addressing the need for better observations of our planet, our neighbours in the solar system and things far far away in both space and time (unravelling the mystery of how the universe came to be as it is today). These missions collect something broadly termed as data, mostly observations. NASA being a fairly siloed organisation, has teams focusing on particular missions and developing their own description regarding the data they collect aimed at subject matter experts. Science in its own way can develop its own priesthood, bent on excluding the "laymen". The aim here was to develop a schema to make sense of NASA data in everyday vocabulary, we basically described all data as being an observation of a target by a sensor, measuring a field or a particle at a point in space-time. Writing that up in RDF required some help from Altova SematicWorks and the presentation some form Prezi. In the end we made it to the global rounds, hopefully our efforts will help the average human being establish their stake on space data if not space itself.

Wednesday, April 25, 2012

Building faster Bundler with CPU/GPU parallelism

The initial Bundler release caused quite a stir allowing simple bundle adjustment from random collection of photos. It leverages the sparse bundle adjustment - SBA created by Lourakis. However being totally single threaded it does not scale quite well to large images. Sift point finding can be accelerated using SiftGPU - Changchang seem to have moved to greater things at Google since his PhD and academic research days.

I have built bundler for Windows 64 bit + CUDA as the MCBA documentation suggests. A few flags are not supported as shown below.
    CHECK_PARAM_SUPPORT(explicit_camera_centers == false);
    CHECK_PARAM_SUPPORT(optimize_for_fisheye);
    CHECK_PARAM_SUPPORT(use_constraints);
    CHECK_PARAM_SUPPORT(use_point_constraints);
    CHECK_PARAM_SUPPORT(fix_points);



I am calling it PBA_Bundler, please give it a try and let me know if it makes bundle adjustments faster for you. The GPU has higher error rates on floating-point calculations and can lead to large bundles drifting off reality. Even computers can have optical illusions. CPU parallel version has less error rate and yields more stable bundles. I am currently working on adding pthreads based parallelism to match filtering stages of Bundler (computing Epipolar Geometry and establishing bundle bounds) and removing the constraint in multi-core bundler which prevents the use of camera constraints.

Sunday, April 15, 2012

Things we do for money - beg, borrow and steal

When I was a child we used to catch the train every morning from Bali station to Howrah, you have to travel long ways at times to go to a good school in India. At the station there usually was a strange man sitting beside a very large pile of hay, gobbling it up. Hay is relatively cheap, but I am sure it is very hard to digest without 4 stomachs and a coterie of symbiotic bacteria. Yet day after day this man sat and ate hay, people were suitably amazed and gave him money to buy more hay. The same applies to performers of any kind, once our stomachs are full of suitably nutritious food (not hay), our minds seek fulfillment as well. We want to be amazed by something extraordinary, stay in touch with people we care about, gloat about the misfortunes of those we hate or envy. The brain feeds on these emotions and burns up the glucose we have consumed.

Fiat currencies have the great blessing of being pure invention, the state says let it be so and money exists - fiat lux. Since the Nixon Shock, currencies are disconnected from materials but attached to emotions and ideas. The society is a very large Markov network, with beliefs about value propagating through every conversation. True value or even truth itself is merely the best presented propaganda. The chinese are no stranger to the vagaries of economy having established the first known instance of paper money, and messed it up through hyperinflation and lack of sovereign discipline.

Content producers directly communicate with our minds through our senses and artists hold the strings to our happiness in their hands. We dance like grand marionettes to the messages being relayed through bands, movies, TV, radio, facebook, churches and Harry Potter novels. We spend money, a product of human ingenuity, on other products of human ingenuity. Last night I attended a small get together, Fee an artist and a friend is garnering support to travel around Australia generating content regarding digital culture. She is being shy about begging for money, but we had to point out to her that she is only begging for it from people who begged, borrowed or stole it in the first place. It is not even begging, it is only borrowing so that she can produce content which will engage people and keep them happy for years to come. We can have better stuff than "Hay" content.

If we, citizens, do not support our artists, then we sacrifice our imagination on the altar of crude reality and we end up believing in nothing and having worthless dreams.  - Yann Martel

Saturday, April 7, 2012

Spontaneous Symmetry breaking and Alan Turing

An embryo in its spherical blastula stage has spherical symmetry, or if there are any deviations from perfect symmetry they cannot be regarded as of any particular importance ... But a system which has spherical symmetry, and whose state is changing because of chemical reactions and diffusion, will remain spherically symmetrical for ever ... it certainly cannot result in an organism such as a horse, which is not spherically symmetrical.
- The Chemical basis for Morphogenesis, Alan Turing.
Resin deposit and butterflies
Spontaneous symmetry breaking is also quite common in Physics. The origins of a lof of forces and particles can be accounted for by asymmetric systems being more stable as whole than a completely symmetric system.

This has a very simple statistical explanation, a perfectly symmetrical state is a very rare occurence compared to the total possibility space of random occurences. Hence the system rapidly deviates from this state. Symmetry is not impossible, but highly improbable. This however does not prevent the consituent elements in the larger system from being highly symmetric, in fact the symmetry is desirable to allow mobility of the constituent to a lower energy more stable state if one becomes available.
Asymmetry is also the basis of the modern economic system globally. There is distinct patchiness in the the distribution of resources on the earth's surface and the reaction-diffusion mechanisms operate by transport of currency or materials (raw or processed) from one part of the earth to another. As the speed of the transport increases the patterning of wealth distribution oscillates. Online transactions have made currency transport nearly instantenous, materials transport still depends on cargo ships and aircraft, but is much much faster today compared to what it was 100 years ago. The wealth spots on the surface of earth are changing faster than the trade winds are blowing, yet they can set up stationary waves where in-spite of the movements the distribution does not shift.

We are all eating off the plate the earth has handed us. In a system with constant energy input, such as the earth receiving energy from the sun and its core via mass-energy conversion, thermodynamic truths such as the total entropy of the system not decreasing do not hold. As we become more proficient with the laws of the universe, we will build more and more symmetric systems/organisms without making a dent on the net asymmetry.

Sunday, April 1, 2012

Locating scattering centers with FDTD

We are so stuck up with visible light and ray tracing where the path of a photon is a straight line that our minds reel at the thought of full-wave simulations and wave based solutions to Maxwell's equations. After all Maxwell believed in the luminiferous aether is required for the waves to propagate.

I have written before on how useful FDTD based methods are for getting an intuitive understanding of electromagnetic propagation, especially through optically complex objects such as forests. For the last few months as part of my PhD work I have been developing simple scheme based representations of vegetation structures in 2-dimensions to solve the wave propagation problem using FDTD. During my research I came across a trilogy popular science books, Branches, Shapes and Flow, describing how simple physical processes lead to the formation of all the complex natural shapes we see.

In a stationery wave field set-up in an FDTD simulation scattering centers appear as point sources similar to the radiation source. To locate these scattering centers accurately without visualising the time-slices, one can apply the Huygens-Fresnel principle. Simply use some image processing tricks  e.g. Generalised Hough, grab some time slices and locate centres of the circular field intensity patterns. To complete the analysis chain up the HDF output from MEEP to OpenCV Hough and you have instant location of scattering centers for fairly complicated scattering problems. The plant material is composed of microwave water, i.e. water with conductivity, permeability and permittivity it shows at microwave frequencies. If water had higher conductivity, we could have used MoM to model forests.

This analysis generates interesting questions about life and what we consider organic shapes vs inorganic(read crystalline) shapes. Under detailed analysis at the right wavelength (DNA capitulated to X-ray crystallography), organic shapes turn out to be formed out of crystalline shapes at multiple scales. What we consider inorganic is just the same material as organic, except it has not gone through sufficient iterations in the fractal generation process. The human mind is predisposed to seeing patterns amid chaos - The Grand Design, and an engineer loves to take the hood off and work out the forces at play which create the finished product. Only then can we assess the strengths and flaws of what we have at hand, and guide the forces to create new products following our own grand design. A lot of cosmetic products use crystalline structures to overlay the naturally evolved organic structures, this fools our heuristics of age determination. Beauty is heuristics anyway, harm will only come if the manipulation of heuristics pauses the continuity of the species.