Need help with my image classification net

451 views
Skip to first unread message

Guoliang Cao

unread,
Oct 16, 2016, 10:33:55 AM10/16/16
to convnetjs
Hi,

I'm trying to use convnetjs to classify 320x240 grayscale image as Rock/Paper/Scissors/Unknown. Here is how I constructed the model

    var layer_defs = [];
    // input layer (all volumes are 3D)
    layer_defs.push({type:'input', out_sx:320, out_sy:240, out_depth:1});
    // output of below layer will be 160x120x8
    layer_defs.push({type:'conv', sx:5, filters:8, stride:2, pad:2, activation:'relu'});
    // output of below layer will be 80x60x8
    layer_defs.push({type:'pool', sx:2, stride:2});
    // output of below layer will be 40x30x8
    layer_defs.push({type:'conv', sx:5, filters:8, stride:2, pad:2, activation:'sigmoid'});
    // output of below layer will be 20x15x8
    layer_defs.push({type:'pool', sx:2, stride:2});
    // a softmax classifier predicting probabilities for four classes: 0,1,2,3
    layer_defs.push({type:'softmax', num_classes:4});

    this.model = new convnetjs.Net();
    this.model.makeLayers(layer_defs);
    this.trainer = new convnetjs.Trainer(this.model, {
      l2_decay:0.001,
      learning_rate: 0.02,
    });

After I train the model for ~100 examples, when I use the model to predict, no matter what image I give, the prediction weights are the same. Anyone know what is wrong with my model?

Thank you for your help!

Guoliang Cao

vladn...@gmail.com

unread,
Jun 22, 2017, 3:31:37 AM6/22/17
to convnetjs
You need thousands of examples if you don't want to overfit. 100 examples is way to little for a proper training. Also, how many iterations of training are you running?

jjrod...@anda.pe

unread,
Feb 26, 2019, 3:28:51 PM2/26/19
to convnetjs
Your model has too much overfitting use more data and apply normalization after convolution. Create synthetic data if you don't have enough data
Reply all
Reply to author
Forward
0 new messages