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

Failed to Inference with a custom model #74

Closed
JoeLan96 opened this issue Jun 20, 2021 · 2 comments
Closed

Failed to Inference with a custom model #74

JoeLan96 opened this issue Jun 20, 2021 · 2 comments

Comments

@JoeLan96
Copy link

Hi,
when I try to inference with a custom model using this code, error occur.

my code as follow:

`
import pixellib
from pixellib.instance import custom_segmentation

segment_image = custom_segmentation()
segment_image.inferConfig(num_classes=2, class_names=["BG", "butterfly", "squirrel"])
segment_image.load_model("./model/Nature_model_resnet101.h5")
segment_image.segmentImage("sample1.jpg", show_bboxes=True, output_image_name="sample_out.jpg")
`

error info:
Traceback (most recent call last):
File "D:/DownProjects/Pixellib/mytrain.py", line 38, in
test1()
File "D:/DownProjects/Pixellib/mytrain.py", line 35, in test1
segment_image.segmentImage("sample1.jpg", show_bboxes=True, output_image_name="sample_out.jpg")
File "D:\ProgramFiles\anaconda\envs\pixellib\lib\site-packages\pixellib\instance.py", line 565, in segmentImage
new_img = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
cv2.error: OpenCV(4.5.2) C:\Users\runneradmin\AppData\Local\Temp\pip-req-build-t9hleyt8\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

Thank you!

@ayoolaolafenwa
Copy link
Owner

ayoolaolafenwa commented Jun 20, 2021

@JoeLan96 the image you specify in the function does not exist. The error is an opencv error for an empty directory. Confirm the directory of your image.

@JoeLan96
Copy link
Author

Thank you for your reply

I'm very sorry I made such a low-level mistake.

Now, I am going to train a sample model that does not need good results to segment the QR code in the picture. I want to know how many pictures need to be labeled as a training set.

Thanks in advance

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