Object Recongition and 3D Pose Estimation are heavily researched topics in Computer Vision. They are often needed in emerging Robotics and Augmented Reality applications. Most common pose estimation methods use single classifier per object, and thus, resulting in a linear growth of complexity with every new object in the environment. In this project, I use a custom hinge-based loss to learn descriptor that separate objects based on their class and 3D pose. Learned feature space will be used in combination with k-nearest neighbour to detect object class and estimate its pose.
Realtime Object Detection and 3D Pose Estimation Pipeline
Loss functions are key components in neural networks research. They guide the networks to approach a local minima that achieves a certain objective (i.e. classification or regression). In this project, I implement a custom hinge loss  that trains on triplets of anchors, pullers and pushers. The custom loss teaches the network to pull the "Pullers" close to the "Anchors" and to push the "Pushers" away from the "Anchors".
Instead of verbosely describing the network architecture, you could find implemented below:
The dataset consists of real and synthetic data. Synthetic data are generated from predefined viewpoints. We use both synthetic and real data for training, and only training data for testing. You could refer to  for a more detailed description. In the following figure, you find the a sample batch of anchors, pullers and pushers.
Learning Feature Descriptors
In this step, we evalualte the both the triplets and pairs loss and sum them up. Afterwards, we backpropagate the changes to the network. Our forward passes contain all anchors, pullers and pushers. We need to index in a way that allow us to separate the anchors from the pullers and pushers in order to be able to evaluate the loss terms. This is designed in the following manner:
After successfully training the network, we obtain relatively good results. We visualize the feature space by passing all the data forward once to generate the features. After that, we use both PCA and t-SNE in order to visualize the data in the feature space.
(a) PCA Embedding (Synthetic)
(b) PCA Embedding (Real / Test Data)
(a) t-SNE Embedding (Synthetic)
(b) t-SNE Embedding (Real / Test Data)
Object Detection & 3D Pose Estimation
The custom hinge-based loss helped form the feature space to satisfy the following requirements:
helped objects from the same class to be “pulled” closer together and from different classes to be “pushed” far away from each other.
helped objects from the same class with similar pose to be “pulled” closer together. Objects with different poses (within the same class) are “pushed” away from each other.
Our loss optimizes the above two criteria simultaneously. It yields in a feature space that is semantically divided such as objects of the same class are clustered together. Objects within a class cluster are re-organized such that similar poses are closer together. This formulation allows for both object detection and 3D pose estimation using a nearest neighbour approach. An object is compared against an existing database of classes and poses. Database feature vectors are pre-computed. For each new object, a feature vector is computed using a forward pass. Afterwards, we search for the closest feature vector to the generated one in the database and predict its label and pose.
Note that, the higher number of poses per class in the dataset, the better our pose estimation is. The granularity of pose estimation is a hyperparameter inferred from industry-specifc needs.
P. Wohlhart and V. Lepetit, “Learning descriptors for object recognition and 3d pose estimation,” in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2015, pp. 3109–3118.