I am trying to resolve this issue. I am trying text recognition using pytesseract using OCR method.

asked 2020-02-24 01:30:24 -0600

cv2.error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\dnn\src\dnn.cpp:4723: error: (-2:Unspecified error) Cannot determine an origin framework of files: in function 'cv::dnn::dnn4_v20191202::readNet'

edit retag flag offensive close merge delete

Comments

please show resp. piece of code.

berak gravatar imageberak ( 2020-02-24 01:54:27 -0600 )edit

code:

# load the pre-trained EAST text detector
print("[INFO] loading EAST text detector...")
net = cv2.dnn.readNet(args["east"])
Kartikey Rai gravatar imageKartikey Rai ( 2020-02-24 14:08:16 -0600 )edit

"Cannot determine an origin framework of files: in function 'cv::dnn::dnn4_v20191202::readNet'"

so this expression args["east"] - does not returns a valid weights file(i.e it should be xxx.weights for yolo, xxx.pb for tensorflow, etc..) Just check your program argument - it most likely does not contain a file extension at all.

holger gravatar imageholger ( 2020-02-25 03:13:28 -0600 )edit

Thank you for your reply! But I am still not able to understand. Can you elaborate a little bit? What I think is that I have to install TensorFlow in my system, right?

Kartikey Rai gravatar imageKartikey Rai ( 2020-02-25 03:32:44 -0600 )edit

No tensorflow installation necessary - thats why you use opencv dnn module for this. Lets start wtih the api
https://docs.opencv.org/4.2.0/d6/d0f/...readNet has 3 arguments

readNet(modelPath, configPath, frameWork);


There 3rd parameter is optional and can be ignored if the weights and config files has the correct extension.They are decribed in the readNet api.In this case opencv tries to determine the framework by iteself.So just make sure to call this function correctly. For example: "yolo_tiny.weights", "yolo_tiny.cfg" Check the api doc. //if file extensions are correct

readNet("yolo_tiny.weights","yolo_tiny.cfg")

//if no or unusual file ext

readNet("yolo_tiny.somext","yolo_tiny.someext", "darknet")
holger gravatar imageholger ( 2020-02-25 04:20:31 -0600 )edit

so this expression args["east"] - does not returns a valid weights file

this is most likely the problem here. please check if:

berak gravatar imageberak ( 2020-02-25 05:18:40 -0600 )edit

Thank you again for the help1 So now I have to download and extract frozen_east_text_detection.pb and extract it and my code will rum, right?

Kartikey Rai gravatar imageKartikey Rai ( 2020-02-26 05:44:11 -0600 )edit

if you havent done so yet -- yes, ofc !

berak gravatar imageberak ( 2020-02-26 06:12:00 -0600 )edit
1

...my code will rum...

Yes it will if it beers no mistake :-)

holger gravatar imageholger ( 2020-02-26 07:29:35 -0600 )edit

I downloaded the frozen_east_text_detection.pb and extracted it. The code is still not working and showing the same error. Please help!

Kartikey Rai gravatar imageKartikey Rai ( 2020-02-26 12:42:53 -0600 )edit