Learning sample with tf.sequential model

Hello,

I succeed to learn images with mobilenet model.

But how to learn image with tf.sequential model ?

const _tf  = require('@tensorflow/tfjs');
const _tfnode = require('@tensorflow/tfjs-node');


/* Case With mobilenet */
const _mobilenet = require('@tensorflow-models/mobilenet');
const _knnClassifier = require('@tensorflow-models/knn-classifier');
...
_myModel	= await _mobilenet.load();
_myClassifier = _knnClassifier.create();
...
// learn img sample as classId
const activation = _myModel.infer( img, true);
_myClassifier.addExample( activation, classId);



/* Case with own-created tf.sequential */
_myModel = _tf.sequential();
// personalize model with layers...
_myModel.add(_tf.layers.conv2d({...

let imageTensor = img
	.resizeNearestNeighbor([96,96])
	.mean(2)
	.toFloat()
	.div( _tf.scalar(255.0))
	.expandDims()
	.expandDims(-1);
	
const activation = _myModel.????

Best regards

Hi @fpi ,

I apologize for the late response. You can follow the steps for training and prediction using your own created model in this Codelab. The tutorial covers training your own model on a set of images, starting from step 9 and continuing through step 14. It explains how to use tf.sequential() to build a model and add layers to it.

Let me know if it helps.

Thank You!!