|
@@ -23,13 +23,13 @@ sct = mss()
|
|
|
stop = 0
|
|
|
|
|
|
a = layers.Input(dtype=tf.float32, shape=(width, height, 3))
|
|
|
-z = Conv2DFPGA(1, kernel_initializer=initializers.Constant(1/25))(a)
|
|
|
+z = Conv2DFPGA(3)(a)
|
|
|
model = models.Model(inputs=a, outputs=z)
|
|
|
|
|
|
|
|
|
-#model.compile(loss=tf.keras.losses.categorical_crossentropy,
|
|
|
-# optimizer=tf.keras.optimizers.Adadelta(),
|
|
|
-# metrics=['accuracy'])
|
|
|
+model.compile(loss=tf.keras.losses.categorical_crossentropy,
|
|
|
+ optimizer=tf.keras.optimizers.SGD(learning_rate=0.03),
|
|
|
+ metrics=['accuracy'])
|
|
|
|
|
|
sct_img = sct.grab(bounding_box)
|
|
|
np_img = np.array(sct_img)
|
|
@@ -56,13 +56,14 @@ while True:
|
|
|
|
|
|
print(batch.shape)
|
|
|
|
|
|
+ model.fit(batch, batch[:,2:226,2:226,:], epochs=1)
|
|
|
predictions = model.predict(batch)
|
|
|
|
|
|
|
|
|
pred8 = tf.cast(predictions, tf.uint8)
|
|
|
for i in range(pred8.shape[0]):
|
|
|
name = 'conv_{}'.format(i)
|
|
|
- cv2.imshow(name, pred8.numpy()[i])
|
|
|
+ cv2.imshow(name, np.clip(pred8.numpy()[i], 0, 255))
|
|
|
cv2.moveWindow(name, x+((i+1)*300)%1500, y+int((i+1)/5)*300)
|
|
|
|
|
|
|