谁能告诉我在mxnet中的cnn自己模型中出了什么问题?

时间:2019-03-12 14:58:35

标签: mxnet

var chart;
var charts = [];
var width;
var height;

width = $('#carousel-example-generic').width();
height = $('#carousel-example-generic').height();

$('.carousel').carousel({
  interval: false,
});

chart = new CanvasJS.Chart("chartContainer1", {
  title: {
    text: "Column Chart"
  },
  width: width,
  height: height,
  data: [{
    type: "column",
    dataPoints: [{
      x: 10,
      y: 171
    }, {
      x: 20,
      y: 155
    }, {
      x: 30,
      y: 150
    }, {
      x: 40,
      y: 165
    }, {
      x: 50,
      y: 195
    }, {
      x: 60,
      y: 168
    }, {
      x: 70,
      y: 128
    }, {
      x: 80,
      y: 134
    }, {
      x: 90,
      y: 114
    }]
  }]
});
chart.render();
charts.push(chart);

chart = new CanvasJS.Chart("chartContainer2", {
  title: {
    text: "Line Chart"
  },
  width: width,
  height: height,
  data: [{
    type: "line",
    dataPoints: [{
      x: 10,
      y: 71
    }, {
      x: 20,
      y: 55
    }, {
      x: 30,
      y: 50
    }, {
      x: 40,
      y: 65
    }, {
      x: 50,
      y: 95
    }, {
      x: 60,
      y: 68
    }, {
      x: 70,
      y: 28
    }, {
      x: 80,
      y: 34
    }, {
      x: 90,
      y: 14
    }]
  }]
});
chart.render();
charts.push(chart);

chart = new CanvasJS.Chart("chartContainer3", {
  title: {
    text: "Area Chart"
  },
  width: width,
  height: height,
  data: [{
    type: "area",
    dataPoints: [{
      x: 10,
      y: 71
    }, {
      x: 20,
      y: 55
    }, {
      x: 30,
      y: 50
    }, {
      x: 40,
      y: 65
    }, {
      x: 50,
      y: 95
    }, {
      x: 60,
      y: 68
    }, {
      x: 70,
      y: 28
    }, {
      x: 80,
      y: 34
    }, {
      x: 90,
      y: 14
    }]
  }]
});
chart.render();
charts.push(chart);

$(window).resize(function() {
  for (var i = 0; i < charts.length; i++) {
    charts[i].options.width = $('.carousel').width();
    charts[i].options.height = $('.carousel').height();
    charts[i].render();
  }
});

运行此部分时出现错误,我的数据集采用pascol voc格式

def acc(output, label):
    correct_preds = output.argmax(axis=1) == label.astype('float32')
    return correct_preds.mean().asscalar()

for epoch in range(10):

    train_loss, train_acc, valid_acc = 0., 0., 0.
    tic = time()

    for data, label in train_data:
        data = data.copyto(mx.cpu(0))
        label = label.copyto(mx.cpu(0))
        with autograd.record():
            output = net(data)
            loss = softmax_cross_entropy(output, label)

        loss.backward()

        trainer.step(batch_size)

        train_loss += loss.mean().asscalar()
        train_acc += acc(output, label)

1 个答案:

答案 0 :(得分:1)

当输入图像对于网络而言太小时,通常会出现

kernel size exceed input错误。您要么需要调整输入图像的大小,要么更改网络体系结构以删除可减少要素地图空间尺寸的图层(例如,合并图层或跨步卷积)。