最近我在keras中实现了一个自定义图层来查找3D点的方向。
我将课程定义如下:
input_layer = Input(shape=(x.shape[1], x.shape[2], x.shape[3], x.shape[4]))
mylayer = STN3D()(input_layer )
model = Model(input_layer, mylayer)
opt = optimizers.SGD(lr=0.001, decay=1e-6, momentum=1.9)
model.compile(loss="mean_squared_error", optimizer=opt)
model.fit(x, y, batch_size=1, epochs=10000, verbose=1)
用法:
1/1 [==============================] - 0s 997us/step - loss: 0.1740
Epoch 9992/10000
1/1 [==============================] - 0s 995us/step - loss: 0.1740
Epoch 9993/10000
1/1 [==============================] - 0s 2ms/step - loss: 0.1740
Epoch 9994/10000
1/1 [==============================] - 0s 996us/step - loss: 0.1740
Epoch 9995/10000
1/1 [==============================] - 0s 2ms/step - loss: 0.1740
Epoch 9996/10000
1/1 [==============================] - 0s 3ms/step - loss: 0.1740
Epoch 9997/10000
1/1 [==============================] - 0s 997us/step - loss: 0.1740
Epoch 9998/10000
1/1 [==============================] - 0s 2ms/step - loss: 0.1740
Epoch 9999/10000
1/1 [==============================] - 0s 996us/step - loss: 0.1740
Epoch 10000/10000
我确定我的“_transform”功能。它可以单独运行,但是当我在我的代码中使用这个图层时,损失值是固定的:
Product::leftJoin('category','category.id_category','=','product.id_category')
->get()
->groupBy('category_id')
->each(function ($group) {
$group->sortBy('product_id')
->map(function ($product, $index) {
$product->seq_no = $index + 1;
});
});
任何建议?