Custom Object Detection With TensorFlow.js Possible?

Hi, is there any good tutorial out there that shows how to train an object detection model using a custom dataset? is it even possible with tfjs?

I’ve seen the coco-ssd tfjs repository and it got it working fine, but if the object you are trying to detect is not in the very limited number of pre-trained classes, the example is not very useful.


1 Like

I haven’t tried it myself but found some promising articles which you might be interested in:

I hope these help. Kind regards,
Gilbert Tanner

Thanks @Gi_T, I’ve actually gone through those articles already, the problem is that they all use either a 3rd party platform or python scripts to perform the training.

I’m trying to find a way to do the training with tfjs. If not possible from scratch, I was hoping there was at least a way to do transfer learning?



Hi Axel,

Object Detection is a hard task (in terms of computer resources) and may take a while to fine tune (customize to your own data).

The easiest solution I can give is to:

I don’t know about an easier path as of now and without Python code for the training, @Jason might have some better insights to share.

1 Like

As @Gi_T has already mentioned my recommendation is to follow Hugo Zanini’s amazing write up on how to retrain YOLO so that you can recognize custom objects and export that resulting model to TensorFlow.js. He walks you through each step in a nice easy way that you should be able to follow which will allow you to use the resulting model via TensorFlow.js in the browser - but as you mentioned does involve a Python pipeline at the start for the purpose of retraining before you convert it over.

Our native TFJS COCO-SSD model has frozen weights and is not suitable for re-training.

On the subject of if it is possible in JS - the short answer is yes, but we are a much younger team than TF Python so we need more people like you to create the examples of tomorrow :slight_smile: An exciting time to be involved as we grow (3x in the last year alone) so now is a great time to grow with the community!

Let us know how you get on! Would love to see more TensorFlow.js examples like Hugo’s out there too but natively in JS. We support Node.js for server side training - and the pre/post processing can be accelerated faster than Python due to the JIT compiler of JS so you may even see some perf boosts there too.

Our community is growing fast so I am sure someone will implement something natively in the not too distant future. If there are any takers reading this please do go for it and tag me if you make it so we can feature you :slight_smile:


@lgusm, @Jason, appreciate the responses. You guys are doing an amazing job. I’ll have a closer look at the resources you shared.