Barcode detector in Tensorflow

Hi there, I have been taking a look at the API and specially some applications (like face-api).

It is very interesting. I am trying now to detect barcodes from images, I know this will be a bit difficult and this are the steps I have in mind:

  • Find some trained network for detecting them, or train one but not in the browser
  • Adapt it to use in the browser and NodeJS

I am a bit clueless though. I have searched for less complex alternatives like Quagg2 but it seems to be quite complex and it may be better time-investment to do TS.

I have checked some of the simplest TFJS examples as well

Some pointers just to start doing something, or discussing about it would be appreciated.

The first step in any ML project is to frame the problem appropriately, so what precisely are you looking to do? There are a few different types of problem I can imagine:

  • Classify images as “contains” vs “does not contain” a barcode,
  • Identify bounding boxes of 1 or more barcodes within a single image, or
  • Read the data represented by a barcode image

If you just want to read a barcode, there are many off-the-shelf solutions available, depending on the type of barcode you want to read. e.g. Firebase’s ML Kit supports barcode reading, Google Cloud’s Document AI can identify barcodes. The Vision API can do a simple “detection” of barcodes (AIUI, without the data behind it) too.

To get started on the other tasks (classifying or bounding-box detecting), if you want to train your own model, you’ll need to collect labelled data first. The simplest approach would be to put that data into something like AutoML, where you can get the model out and then load it in TF.js. But you could also follow one of the image training tutorials to do it directly in TensorFlow.js (e.g. this or this).

Hopefully this helps you get started!

1 Like

Thank you so much for the reply!! :slight_smile:

I tried many non ML detectors models out there. None of them is accurate (in JS at least.)

  • I need to get the bounding box for 1 or more barcodes in image in Node JS.

I read the links and.am left w the ones in the last paragraph. I plan to release this as MIT, so if it works it’d be good I guess (not much out there.)

@macd

Any comments?