fix the bug about open cv type error in line function. #38
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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'
So convert the float list to a int list to fix this error. Pass test in torch1.7 & opencv 4.5.5.