未验证 提交 7219a0e1 编写于 作者: L LokeZhou 提交者: GitHub

fix PP-HumanV2 PP-TinyPose PP-Vehicle video adaptive code (#5689)

* fix PP-HumanV2 PP-Vehicle Single choice bug

* add PP-TinyPose model file

* modified PP-TinyPose auto download model

* del modelcenter/PP-TinyPose/APP/output_inference/

* add PP-TinyPose PP-HumanV2 PP-Vehicle video format checks

* fix PP-HumanV2 PP-TinyPose PP-Vehicle video adaptive code
上级 c3c30285
...@@ -389,8 +389,7 @@ class PipePredictor(object): ...@@ -389,8 +389,7 @@ class PipePredictor(object):
def set_file_name(self, path): def set_file_name(self, path):
if path is not None: if path is not None:
if "." in path: self.file_name = path
self.file_name = path.split(".")[-2]
else: else:
# use camera id # use camera id
self.file_name = None self.file_name = None
...@@ -446,9 +445,9 @@ class PipePredictor(object): ...@@ -446,9 +445,9 @@ class PipePredictor(object):
frame_count = int(capture.get(cv2.CAP_PROP_FRAME_COUNT)) frame_count = int(capture.get(cv2.CAP_PROP_FRAME_COUNT))
print("video fps: %d, frame_count: %d" % (fps, frame_count)) print("video fps: %d, frame_count: %d" % (fps, frame_count))
video_out_name = 'output' if self.file_name is None else self.file_name video_name,suffix = os.path.splitext(self.file_name)
out_path = video_out_name + "_output.mp4" out_path = video_name + "_output"+suffix
fourcc = cv2.VideoWriter_fourcc(*'mp4v') fourcc = int(capture.get(cv2.CAP_PROP_FOURCC))
writer = cv2.VideoWriter(out_path, fourcc, fps, (width, height)) writer = cv2.VideoWriter(out_path, fourcc, fps, (width, height))
frame_id = 0 frame_id = 0
......
...@@ -107,8 +107,9 @@ def topdown_unite_predict_video(FLAGS, ...@@ -107,8 +107,9 @@ def topdown_unite_predict_video(FLAGS,
capture = cv2.VideoCapture(camera_id) capture = cv2.VideoCapture(camera_id)
else: else:
capture = cv2.VideoCapture(FLAGS.video_file) capture = cv2.VideoCapture(FLAGS.video_file)
video_name,suffix = FLAGS.video_file.split('.') video_name,suffix = os.path.splitext(FLAGS.video_file)
video_name = video_name+"_output."+suffix video_name = video_name+"_output"+suffix
# Get Video info : resolution, fps, frame count # Get Video info : resolution, fps, frame count
width = int(capture.get(cv2.CAP_PROP_FRAME_WIDTH)) width = int(capture.get(cv2.CAP_PROP_FRAME_WIDTH))
height = int(capture.get(cv2.CAP_PROP_FRAME_HEIGHT)) height = int(capture.get(cv2.CAP_PROP_FRAME_HEIGHT))
...@@ -116,9 +117,8 @@ def topdown_unite_predict_video(FLAGS, ...@@ -116,9 +117,8 @@ def topdown_unite_predict_video(FLAGS,
frame_count = int(capture.get(cv2.CAP_PROP_FRAME_COUNT)) frame_count = int(capture.get(cv2.CAP_PROP_FRAME_COUNT))
print("fps: %d, frame_count: %d" % (fps, frame_count)) print("fps: %d, frame_count: %d" % (fps, frame_count))
codec = int(capture.get(cv2.CAP_PROP_FOURCC))
fourcc = cv2.VideoWriter_fourcc(* 'mp4v') writer = cv2.VideoWriter(video_name, codec, fps, (width, height))
writer = cv2.VideoWriter(video_name, fourcc, fps, (width, height))
index = 0 index = 0
store_res = [] store_res = []
keypoint_smoothing = KeypointSmoothing( keypoint_smoothing = KeypointSmoothing(
......
...@@ -329,8 +329,7 @@ class PipePredictor(object): ...@@ -329,8 +329,7 @@ class PipePredictor(object):
def set_file_name(self, path): def set_file_name(self, path):
if path is not None: if path is not None:
if "." in path: self.file_name = path
self.file_name = path.split(".")[-2]
else: else:
# use camera id # use camera id
self.file_name = None self.file_name = None
...@@ -397,9 +396,9 @@ class PipePredictor(object): ...@@ -397,9 +396,9 @@ class PipePredictor(object):
frame_count = int(capture.get(cv2.CAP_PROP_FRAME_COUNT)) frame_count = int(capture.get(cv2.CAP_PROP_FRAME_COUNT))
print("video fps: %d, frame_count: %d" % (fps, frame_count)) print("video fps: %d, frame_count: %d" % (fps, frame_count))
video_out_name = 'output' if self.file_name is None else self.file_name video_name,suffix = os.path.splitext(self.file_name)
out_path = video_out_name + "_output.mp4" out_path = video_name + "_output"+suffix
fourcc = cv2.VideoWriter_fourcc(*'mp4v') fourcc = int(capture.get(cv2.CAP_PROP_FOURCC))
writer = cv2.VideoWriter(out_path, fourcc, fps, (width, height)) writer = cv2.VideoWriter(out_path, fourcc, fps, (width, height))
frame_id = 0 frame_id = 0
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册