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

fix the bug about open cv type error in line function. #38

Merged
merged 1 commit into from
Jan 20, 2022
Merged

fix the bug about open cv type error in line function. #38

merged 1 commit into from
Jan 20, 2022

Conversation

fishfl
Copy link
Contributor

@fishfl fishfl commented Jan 15, 2022

For the latest version of OpenCV, the line function make the parameter must be 'Int' type. which here got float list.
So we will got this error:

Traceback (most recent call last):
File "demo.py", line 262, in
current_pred_feature_map = facedataset.dataset.get_data_test_mode(pred_landmarks[ind],
File "D:\codebase\pydl\cv\73_LiveSpeechPortraits-main\datasets\face_dataset.py", line 280, in get_data_test_mode
feature_map = torch.from_numpy(self.get_feature_image(landmarks, (self.opt.loadSize, self.opt.loadSize), shoulder, pad)[np.newaxis, :].astype(np.float32)/255.)
File "D:\codebase\pydl\cv\73_LiveSpeechPortraits-main\datasets\face_dataset.py", line 295, in get_feature_image
im_edges = self.draw_shoulder_points(im_edges, shoulders)
File "D:\codebase\pydl\cv\73_LiveSpeechPortraits-main\datasets\face_dataset.py", line 305, in draw_shoulder_points
img = cv2.line(img, tuple(shoulder_points[i * num + j]), tuple(shoulder_points[i * num + j + 1]), 255, 2) # BGR
cv2.error: OpenCV(4.5.5) 👎 error: (-5:Bad argument) in function 'line'

Overload resolution failed:

  • Can't parse 'pt1'. Sequence item with index 0 has a wrong type
  • Can't parse 'pt1'. Sequence item with index 0 has a wrong type

So convert the float list to a int list to fix this error. Pass test in torch1.7 & opencv 4.5.5.

@YuanxunLu YuanxunLu merged commit 2889191 into YuanxunLu:main Jan 20, 2022
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

Successfully merging this pull request may close these issues.

2 participants