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

11.2 Detecting Multiple Images -- Issue with the format_img function #84

Open
ValentinDelpy opened this issue Nov 13, 2020 · 2 comments

Comments

@ValentinDelpy
Copy link

Hi,
We are trying to implement the Notebook, and we have the error following : "NameError: name 'format_img' is not defined", at the line "X, ratio = format_img(img,c)", of the following code,

`img = cv2.imread('data/cat_dog.jpg')
X, ratio = format_img(img, c)

if K.image_dim_ordering() == 'tf':
X = np.transpose(X, (0, 2, 3, 1))

y1, y2, f = model_rpn.predict(X)
r = keras_frcnn.roi_helpers.rpn_to_roi(y1, y2, c, K.image_dim_ordering(), overlap_thresh=0.7)
roi_count = R.shape[0] // c.num_rois
r2 = np.zeros((roi_count * c.num_rois, r.shape[1]))
r2 = r[:r2.shape[0],:r2.shape[1]]
r2 = np.reshape(r2, (roi_count, c.num_rois, r.shape[1]))
`

Is the function defined somewhere in the project ? We can't retrieve it, and can't solve this issue.

@mikechen66
Copy link

mikechen66 commented Apr 24, 2021

I tried the the methods as follows. All the new methods could not work. I thought that format_img() might be either CV2 or PIL methods. However, I could not find the trackback in the web.

# -X, ratio = format_img(img, c)
X, ratio = format.img(img, c)
AttributeError: 'builtin_function_or_method' object has no attribute 'img'


# -X, ratio = format_img(img, c)
X, ratio = format(img, c)
TypeError: format() argument 2 must be str, not Config

# -X, ratio = format_img(img, c)
X, ratio = im.format(img, c)
NameError: name 'im' is not defined

@mikechen66
Copy link

mikechen66 commented Apr 24, 2021

format_img() is included in the library keras_frcnn. Please import the function of format_img() as follows.

from measure_map import format_img

Cheers

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

2 participants