conv_filter = keras.layers.convolutional.Conv2D( 4, (1,1), activation="relu", use_bias=True, kernel_regularizer = keras.regularizers.l2(0.001) )(drop1) conv_filter input 7 x 7 x 4 base_model 224 x 224 x 3 7 x 7 x 2048
keras.models.Model( inputs=base_model.input, outputs=logits ) conv_filter patch pool logits input classifier ho g” / “no t ” 7 x 7 x 2 7 x 7 x 4 224 x 224 x 3 7 x 7 x 2048 2 2
imageData = this.offscreen .getImageData(0, 0, 640, 480) var pixeldata = tf.fromPixels(imageData) var response = await tf.tidy(() => this.model.predict(preprocess(pixeldata)) ) responseData = await postprocess( response, pixeldata, 640, 480 ).data() for (var i = 0; i < responseData.length; i+=1) { imageData.data[i] = responseData[i] } this.onscreen.putImageData(imageData, 0, 0) this.continue() } of c model.predict() p e r s po p s co on r <vi >
.mul(grayscale).squeeze() .mul(tf.scalar(0.3)) grayscaleStacked = tf.stack( [grayscale, grayscale, grayscale]) .transpose([1,2,0]) composite = pixeldata .mul(heatmap) .add(grayscaleStacked) var rgb = tf.split(composite, 3, 2) var alpha = tf.onesLike(rgb[0]) .mul(tf.scalar(255)) rgb.push(alpha) var composite = tf.stack(rgb, 2) return composite.toInt() pi d a he p 1-he p g a s co s e