Search code examples
javascripttensorflowdeep-learningartificial-intelligenceimage-segmentation

Semantic Segmentation in JavaScript


It's my second time of posting this question but in different words. I am new to AI and deep learning. I want to make a tool to replace the floor in a image with different patterns. I made a datasets of almost 250 pictures and stored them in a json file. Using trainMask R-CNN model I got some results (using Python), but I want to use JavaScript. I converted my model into tf.js format but I face different challenges, like how to load the model in tf.js, and how to predict.

Can any one help me to start segmentation in an easy and fast way for custom datasets. I don't understand tf.js.


Solution

  • To load a model in tf.js you can use the tf.loadGraphModel function

    async function loadModel() {
        model = await tf.loadGraphModel("model/path");
        // do what you need with the model
    }
    

    For prediction take a look at the tf.js API