Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prediction output of FPGA is always ZERO! #1026

Open
zsrabbani opened this issue Jul 1, 2024 · 1 comment
Open

Prediction output of FPGA is always ZERO! #1026

zsrabbani opened this issue Jul 1, 2024 · 1 comment
Labels

Comments

@zsrabbani
Copy link

zsrabbani commented Jul 1, 2024

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 zsrabbani added the bug label Jul 1, 2024
@zsrabbani
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant