hls4ml icon indicating copy to clipboard operation
hls4ml copied to clipboard

Prediction output of FPGA is always ZERO!

Open zsrabbani opened this issue 1 year ago • 1 comments

I have a CNN model with qkeras. I used the hls4ml and all file and bitfile generated completely. Now I used the deployment code to implement on FPGA(ZCU104), the prediction output of FPGA is always Zero. I even checked that I have weights.

I will appericate for helping me.

Here is the Model: rf_in = Input(shape=(1024, 2), name = 'rf_input')

x = QConv1D(64, 5, kernel_quantizer="quantized_bits(16,6)", padding='same', use_bias=False)(rf_in) x = QBatchNormalization()(x) x = QActivation("quantized_relu(16,6)")(x) x = MaxPooling1D(2, strides = 2, padding='same') (x)

x = QConv1D(32, 5, kernel_quantizer="quantized_bits(16,6)", padding='same', use_bias=False)(x) x = QBatchNormalization()(x) x = QActivation("quantized_relu(16,6)")(x) x = MaxPooling1D(2, strides = 2, padding='same') (x)

x = QConv1D(16, 5, kernel_quantizer="quantized_bits(16,6)", padding='same', use_bias=False)(x) x = QBatchNormalization()(x) x = QActivation("quantized_relu(16,6)")(x) x = MaxPooling1D(2, strides=2, padding='same') (x)

x = Flatten()(x) dense_1 = QDense(128, kernel_quantizer="quantized_bits(16,6)", use_bias=False)(x) dropout_1 = Dropout(0.25)(dense_1) dense_2 = QDense(128, kernel_quantizer="quantized_bits(16,6)", use_bias=False)(dropout_1) dropout_2 = Dropout(0.5)(dense_2) softmax = QDense(7, kernel_quantizer="quantized_bits(16,6)", use_bias=False)(dropout_2) output = Activation('softmax', name='output')(softmax)

opt = keras.optimizers.Adam(learning_rate=0.0001)

model = keras.Model(rf_in, output) model.compile(loss='categorical_crossentropy', optimizer=opt, metrics=["accuracy"]) #model.summary()

Here is the deployment code: image

zsrabbani avatar Jul 01 '24 12:07 zsrabbani

Does anyone have an idea how to add my weights to ZCU104? I just added the files mentioned in the tutorial.

zsrabbani avatar Jul 10 '24 13:07 zsrabbani