I have some machinery at work with a small sticker I am trying to detect within a larger image. I am familiar with object detection techniques based on a trained classification model, but to further complicate the matter, the following scenarios are possible and need to be identified:

  1. The sticker exists (correct orientation)
  2. The sticker exists but is inside-out
  3. The sticker exists but is upside-down
  4. The sticker exists but is inside-out AND upside-down
  5. The sticker does not exist in the image

Options 2,3,4, and 5 are essentially all the same outcome... I just need to label these as BAD, while option 1 is the only GOOD case.

I can't post the actual pictures I am working with, but sketched out approximations of the different sticker options. These are examples of the stickers, but keep in mind the actual images I'm working with are much less crisp... the pixelization and shadowing/lighting from a camera makes it much more difficult to identify crisp contours.


I attempted to solve this problem with template matching since I was just trying to identify the sticker in the larger image, but that proved to be a waste of my time because template matching fails miserably for all cases except 1 and 5 (I can tell reasonably well based on score thresholds whether or not the image exists). It does ok with case 2 since the overall contours being identified are then backwards and a slightly different color when compared against the correct case, but again thresholding to extract just the contours of this sticker has proved difficult.

Cases 3 and 4 are exceptionally difficult to identify as bad, since the contours almost exactly match the good case 1. The main difference is that there is a larger dead space of yellow at the top of image 1, whereas in 3 and 4 that dead space is at the bottom since they've been flipped. I was hoping to use that in my identification, but I am stumped on how to do this part.

What machine vision / image processing techniques can I used to correctly classify case 1 as good, while identifying all the others as bad?


1 Answer 1


Since I never got any suggestions, I'll answer my own question with my solution. I went ahead and just trained an object classification model with the TensorFlow object detection libraries, found here.

I trained the model on multiple examples of each of the possible orientations 1-5. It appears to do a remarkably great job of identifying all 5 possible orientations. I've left a feedback option for technicians using the object detection tools on the shop floor, and as we use the model, I will continue to re-train/update it based on the results.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.