PERF 修改视频切片长度为输入长度
This commit is contained in:
parent
6f83efdd94
commit
d4978b8a4a
|
|
@ -54,7 +54,7 @@ class FaceDetect:
|
||||||
config = {"start": start, "end": end}
|
config = {"start": start, "end": end}
|
||||||
else:
|
else:
|
||||||
raise RuntimeError("未找到符合要求的视频片段")
|
raise RuntimeError("未找到符合要求的视频片段")
|
||||||
return (image, image_selected, cls, prob, nums, str(period), json.dumps(config), start, end - start)
|
return (image, image_selected, cls, prob, nums, str(period), json.dumps(config), start, end - start+1)
|
||||||
|
|
||||||
|
|
||||||
class FaceExtract:
|
class FaceExtract:
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,13 @@ def test_node(image:torch.Tensor,length=10,thres=95,model_name="convnext_tiny"):
|
||||||
end = nums[idx]
|
end = nums[idx]
|
||||||
if end - start + 1 >= length:
|
if end - start + 1 >= length:
|
||||||
period.append([start, end])
|
period.append([start, end])
|
||||||
return (image.permute(0,2,3,1), image.permute(0,2,3,1)[nums,:,:,:], str(preds), str(probs), str(nums), period)
|
temp_period = []
|
||||||
|
for i in period:
|
||||||
|
a = i[0]
|
||||||
|
while a+length-1 <= i[1]:
|
||||||
|
temp_period.append([a,a+length-1])
|
||||||
|
a = a+length
|
||||||
|
return (image.permute(0,2,3,1), image.permute(0,2,3,1)[nums,:,:,:], str(preds), str(probs), str(nums), temp_period)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue