.

Glasses.com App with 3Dfit Technology

.

.
glasses logo, promo-01Many find the experience of purchasing new glasses stressful. Even simply trying on frames can be uncomfortable when done in a public setting. Glasses.com set out to improve the experience by providing customers a way of virtually trying on glasses frames in the comfort of their homes via smart phone or tablet.

The Glasses.com app takes a picture of the user’s face, creates a 3D model of facial features, and virtually places selected frames on the user’s 3D image. The user is then free to view the 3D image from a variety of angles.

The application relies on computer vision to recognize the features of a user’s face and then generate an accurate, high-fidelity, 3D model of that face. Virtual frames can then be positioned on the 3D model.

This app is amazing! It takes a 3D video of your face in just a few steps, and the rendering is spot on! RayBan Aviators are always a little big on me, and the app showed them on my face exactly as they fit in the store! —davidandrew

Mission

Glasses.com brought our engineers an excellent, fully-functioning version of the application; they simply wanted it accelerated. The app took full advantage of the CPU, which—left unchanged—would necessitate Glasses.com’s purchasing and managing a large amount of hardware. Further, the application was running at a slow thirty seconds per session, resulting in a sub-optimal user experience. Our engineers were tasked with parallelizing the process and reducing the session runtime.

Glasses.com has several machines they are using in production. Their main setup consists of a Haswell/Ivy Bridge CPU paired with a GTX 690. The machine is able to run 4 processes concurrently. In the past, Glasses.com used a 32 core Intel process with a couple of K20X. They are still using these machines, but they are not the main configuration. They are also making use of the Amazon EC2 instances in case they exceed internal capacity.

Action

We began by analyzing the application and targeting the process which would have the greatest impact on performance.

The most pressing concern was the rendering portion of code, which was running on the CPU. We implemented rendering in ArrayFire, which is specially optimized for CUDA GPUs. Further, we noticed that while the application was rendering-intensive, much of the rendering did not need to be precise—we could make estimations without compromising quality. This estimated rendering speedup operation was critical to the success of the project.

We discovered further opportunities for speedup within the architecture itself. The original app processed each frame in a separate thread; we accelerated this by combining each operation into a single kernel and running that kernel once. By moving the parallelization to the GPU we effectively took advantage of the strength of that architecture.

Results

Ultimately, parallelizing the application and incorporating the ArrayFire software library accelerated the application to about ten seconds per session—roughly three times as fast as the original code, and twice as fast as the target speed. We further exceeded expectations by improving general stability when handling errors. glassesdotcom benchmarks

The improvements in speed, stability, and user experience have resonated with the application’s target market, resulting in a 3.5/5 star rating in the Apple Store.

About glasses.com

Glasses.com launched in 2011 as an online retailer of prescription and non-prescription glasses and sunglasses, carrying a wide-range of styles and name brands such as Oakley, Ray-Ban, Kate Spade, Burberry, Maui Jim, and more.

.