Cv2.error: Transpose is not implemented in function 'ReadDarknetFromWeightsStream'

I am having this error with OpenCV while I am deploying my model API to streamlit cloud !
Also the API runs perfectly in my local environment .

Following is the Log message :

Traceback (most recent call last):
  File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
    exec(code, module.__dict__)
  File "/app/anomalizer/app.py", line 22, in <module>
    lug_model = cv2.dnn.readNetFromDarknet("yolov4_test2.cfg", "yolov4_train2_final.weights")
cv2.error: OpenCV(4.7.0) /io/opencv/modules/dnn/src/darknet/darknet_io.cpp:933: error: (-213:The function/feature is not implemented) Transpose the weights (except for convolutional) is not implemented in function 'ReadDarknetFromWeightsStream'

I have used GIT LFS to upload the .weights file to the repo
Can anyone help me fix it to deploy my app on the cloud?

Following is the link to my repository if anyone wants to debug it :
Raafeh/anomalizer (github.com)

Check your LFS bandwidth and storage usage.

I have storage available in in my LFS

After a quick look at your Github repo, I would say that your app in this version - apart from the original problem - will never work on Streamlit Cloud anyway, for the following reasons:

  • I have my doubts that you can run Fastapi in parallel with Streamlit on Streamlit Cloud
  • Video recording with cv2.VideoCapture() will definitely not work on Streamlit Cloud

So what should I do if I just want to upload a video and take predictions from my model ?

https://docs.streamlit.io/library/api-reference/widgets/st.file_uploader

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.