0

ok so i tried this

import cv2 as cv

cvNet = cv.dnn.readNetFromTensorflow('frozen_inference_graph.pb', 'graph.pbtxt')

img = cv.imread('example.jpg')
rows = img.shape[0]
cols = img.shape[1]
cvNet.setInput(cv.dnn.blobFromImage(img, size=(300, 300), swapRB=True, crop=False))
cvOut = cvNet.forward()

for detection in cvOut[0,0,:,:]:
    score = float(detection[2])
    if score > 0.3:
        left = detection[3] * cols
        top = detection[4] * rows
        right = detection[5] * cols
        bottom = detection[6] * rows
        cv.rectangle(img, (int(left), int(top)), (int(right), int(bottom)), (23, 230, 210), thickness=2)

cv.imshow('img', img)
cv.waitKey()

and it request me error like this

Traceback (most recent call last): File "C:\WINDOWS\System32\numpy_init_.py", line 140, in from . import _distributor_init File "C:\WINDOWS\System32\numpy_distributor_init.py", line 34, in from . import mklinit ImportError: cannot import name 'mklinit' from partially initialized module 'numpy' (most likely due to a circular import) (C:\WINDOWS\System32\numpy_init.py) Traceback (most recent call last): File "C:\Users\phat\Downloads\start.py", line 1, in import cv2 as cv File "C:\Users\phat\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\cv2_init.py", line 5, in from .cv2 import * ImportError: numpy.core.multiarray failed to import

can anyone help me?

Phat
  • 11
  • 1

0 Answers0