You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am currently working on Yolov3 implementation on FPGA.
The build dataflow works fine and the FPGA execution as well, I want to verify my input data (npy format) with expected output using verify_steps, while executing the code I got this error :
Running step: step_qonnx_to_finn [1/19]
Running verification for finn_onnx_python
Verification input has shape (1, 3, 640, 640) while model expects [1, 3, 640, 640]
Attempting to force model shape on verification input
Traceback (most recent call last):
File "/users/local/ismail_env/finn_dev/src/finn/builder/build_dataflow.py", line 158, in build_dataflow_cfg
model = transform_step(model, cfg)
File "/users/local/ismail_env/finn_dev/src/finn/builder/build_dataflow_steps.py", line 283, in step_qonnx_to_finn
verify_step(model, cfg, "finn_onnx_python", need_parent=False)
File "/users/local/ismail_env/finn_dev/src/finn/builder/build_dataflow_steps.py", line 184, in verify_step
out_dict = execute_onnx(model, inp_dict, True)
File "/users/local/ismail_env/finn_dev/src/finn/core/onnx_exec.py", line 54, in execute_onnx
return execute_onnx_base(model, input_dict, return_full_exec_context, start_node, end_node)
File "/users/local/ismail_env/finn_dev/deps/qonnx/src/qonnx/core/onnx_exec.py", line 125, in execute_onnx
raise Exception("Found unspecified tensor shapes, try infer_shapes")
Exception: Found unspecified tensor shapes, try infer_shapes
> /users/local/ismail_env/finn_dev/deps/qonnx/src/qonnx/core/onnx_exec.py(125)execute_onnx()
-> raise Exception("Found unspecified tensor shapes, try infer_shapes")
Here is my code to generate input/output npy data :
import torch
import argparse
import numpy as np
from models.yolo import Detect, Model
from models.experimental import Ensemble
def main():
parser = argparse.ArgumentParser(description="in/out verif npy")
parser.add_argument(
"-w",
"--weights",
type=str,
help="Weights",
required=True,
)
parser.add_argument(
"-c",
"--cfg",
type=str,
help="checkpoint",
required=True,
)
args = parser.parse_args()
device = "cpu"
model = Ensemble()
ckpt = torch.load(args.weights, map_location=device)
model_state_dict = ckpt["model_state_dict"]
detection = Model(cfg=args.cfg, ch=3, nc=1)
detection.load_state_dict(model_state_dict)
detection.to(device).eval()
model.append(detection)
input_shape = [1, 3, 640, 640]
dummy_input = torch.randint(-2**7, 2**7 -1 , input_shape, dtype=torch.int8).to(device).float()
output = model(dummy_input)
np.save("verif_input.npy", dummy_input.cpu().detach().numpy())
# Check if output is a tuple
if isinstance(output, tuple):
for i, out in enumerate(output):
if out is not None:
np.save(f"verif_output_{i}.npy", out.cpu().detach().numpy())
else:
np.save("verif_output.npy", output.cpu().detach().numpy())
if __name__ == "__main__":
main()
I do not know where the error comes from, I'll be happy to get your suggestions.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi everyone,
I am currently working on Yolov3 implementation on FPGA.
The build dataflow works fine and the FPGA execution as well, I want to verify my input data (npy format) with expected output using verify_steps, while executing the code I got this error :
Here is my code to generate input/output npy data :
I do not know where the error comes from, I'll be happy to get your suggestions.
Thank you in advance
Beta Was this translation helpful? Give feedback.
All reactions