Best vision tool for part identification?

I have been tasked with re-designing a vision system for an automated machine. It currently uses pattern matching functionality with an omron vision system, and we are looking to create our own.

Parts are backlit with lights and a clear outline of the part is visible. I want to be able to determine if the part is in the forward or reverse position.
An example as follows:

Where the above image would be the part in the forward position, and its mirror would be the part in the reverse orientation. I would’ve inserted two images, but it wouldn’t let me since I’m a new account.

I had initially thought to make a cascade classifier and teach it using the forward position as the positive images, but am unsure what to use as the negative images. Different parts with different profiles? Completely different images?

Also is this the most effective tool for this job? I had also tried using the pattern matching functionality, but the orientation of the part could vary plus or minus 5 degrees.

Current OpenCV versions no longer contain the tools to train Haar/LBP cascade classifiers.

That was removed because those things are a subset of contemporary neural networks.

The practical advice is to train a classifier using commonly available neural network training. OpenCV is capable of running (inference) many kinds of neural networks in many formats.

If you want to go the Machine Vision route, you need to stop thinking in terms of machine learning. An MV approach would physically constrain the object in as many degrees of freedom as possible. The remaining degrees need to be measured using pixel/area samples of the picture.