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

Tiny Yolo V3 #2

Open
alejoGT1202 opened this issue Mar 17, 2022 · 5 comments
Open

Tiny Yolo V3 #2

alejoGT1202 opened this issue Mar 17, 2022 · 5 comments

Comments

@alejoGT1202
Copy link

Hi I trained a tiny yolo v3 model with the scripts provided in this repo, however when I tried the test.py script I got the following error:

input shape: torch.Size([1, 3, 224, 224])
/home/alejo/Documents/MaixPy/v831_yolo/models/tiny_yolo_v3.py:240: TracerWarning: Converting a tensor to a NumPy array might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  all_obj = all_obj.to('cpu').numpy()
/home/alejo/Documents/MaixPy/v831_yolo/models/tiny_yolo_v3.py:241: TracerWarning: Converting a tensor to a NumPy array might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  all_class = all_class.to('cpu').numpy()
/home/alejo/Documents/MaixPy/v831_yolo/models/tiny_yolo_v3.py:242: TracerWarning: Converting a tensor to a NumPy array might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  all_bbox = all_bbox.to('cpu').numpy()
Traceback (most recent call last):
  File "test.py", line 237, in <module>
    torch_to_onnx(net.to("cpu"), input_shape, onnx_out, device="cpu")
  File "/home/alejo/Documents/MaixPy/v831_yolo/convert.py", line 15, in torch_to_onnx
    torch.onnx.export(net, x, out_name, export_params=True, input_names = input_names, output_names=output_names)
  File "/home/alejo/Documents/MaixPy/sipeed/lib/python3.8/site-packages/torch/onnx/__init__.py", line 316, in export
    return utils.export(model, args, f, export_params, verbose, training,
  File "/home/alejo/Documents/MaixPy/sipeed/lib/python3.8/site-packages/torch/onnx/utils.py", line 107, in export
    _export(model, args, f, export_params, verbose, training, input_names, output_names,
  File "/home/alejo/Documents/MaixPy/sipeed/lib/python3.8/site-packages/torch/onnx/utils.py", line 724, in _export
    _model_to_graph(model, args, verbose, input_names,
  File "/home/alejo/Documents/MaixPy/sipeed/lib/python3.8/site-packages/torch/onnx/utils.py", line 493, in _model_to_graph
    graph, params, torch_out, module = _create_jit_graph(model, args)
  File "/home/alejo/Documents/MaixPy/sipeed/lib/python3.8/site-packages/torch/onnx/utils.py", line 437, in _create_jit_graph
    graph, torch_out = _trace_and_get_graph_from_model(model, args)
  File "/home/alejo/Documents/MaixPy/sipeed/lib/python3.8/site-packages/torch/onnx/utils.py", line 388, in _trace_and_get_graph_from_model
    torch.jit._get_trace_graph(model, args, strict=False, _force_outplace=False, _return_inputs_states=True)
  File "/home/alejo/Documents/MaixPy/sipeed/lib/python3.8/site-packages/torch/jit/_trace.py", line 1166, in _get_trace_graph
    outs = ONNXTracedModule(f, strict, _force_outplace, return_inputs, _return_inputs_states)(*args, **kwargs)
  File "/home/alejo/Documents/MaixPy/sipeed/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/alejo/Documents/MaixPy/sipeed/lib/python3.8/site-packages/torch/jit/_trace.py", line 127, in forward
    graph, out = torch._C._create_graph_by_tracing(
  File "/home/alejo/Documents/MaixPy/sipeed/lib/python3.8/site-packages/torch/jit/_trace.py", line 121, in wrapper
    out_vars, _ = _flatten(outs)
RuntimeError: Only tuples, lists and Variables are supported as JIT inputs/outputs. Dictionaries and strings are also accepted, but their usage is not recommended. Here, received an input of unsupported type: numpy.ndarray

Is it possible to use the other yolo versions or only the slim yolo v2?

@ZKH66
Copy link

ZKH66 commented Apr 4, 2022

Have you solved the problem?

@alejoGT1202
Copy link
Author

No, it only works with slim_yolo v2

@ZKH66
Copy link

ZKH66 commented Apr 4, 2022

I would like to ask if v831 can only use resnet18 and yolov2, have you experimented on the development board

@alejoGT1202
Copy link
Author

Apparently yes on my v831 board I could only deploy a model using yolov2 for detection and resnet18 for classification.

@dianjixz
Copy link
Owner

This repositories was prepared for V831, mainly using slim_YOLO V2 model. you may need to modify some code,when you to use other models.

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

No branches or pull requests

3 participants