bmf icon indicating copy to clipboard operation
bmf copied to clipboard

运行人脸检测demo时会一直打印:[info] *** dropping frame 7 at ts 3584。请问:dropping frame是什么意思?是检测时抽帧检测的吗?谢谢

Open QQiangren opened this issue 9 months ago • 4 comments

我的代码如下: import torch import torch.nn.functional as F import numpy as np import sys import time import tensorrt as trt import bmf.hml.hmp as mp from nms import NMS import PIL from PIL import Image

def main(): graph1 = graph({'dump_graph':1})

video = graph1.decode({
    "input_path": "./face.mp4",
    #"video_params": {
    #    "hwaccel": "cuda",
    #}
})["video"]

video = video.module("trt_face_detect", {
    "model_path": "./version-RFB-640.engine",
    "label_to_frame": 1,
    "input_shapes": {
        "input": [1, 3, 480, 640]
    }}, entry="trt_face_detect.trt_face_detect")

video = video.encode(
    None, {
        "output_path": "./trt_out.mp4",
        "video_params": {
            "codec": "h264_nvenc",
            "bit_rate": 5000000,
        }
    })

video.run()

if name == "main": main()

QQiangren avatar May 08 '24 05:05 QQiangren

这是编码(video.encode)时默认按照25 fps的帧率根据你的输入视频帧率来决定是否丢帧的策略。

sfeiwong avatar May 08 '24 09:05 sfeiwong

麻烦请问编码时默认的25 fps帧率是否可以修改?在哪里可以设置。谢谢

QQiangren avatar May 08 '24 15:05 QQiangren

可以在encode的参数中配置: "video_params": { "max_fr": 30 }, 参考bmf文档:https://babitmf.github.io/docs/bmf/api/encode_module/

sfeiwong avatar May 09 '24 03:05 sfeiwong

感谢指导,增加max_fr参数后,可以达到预期目标

QQiangren avatar May 09 '24 06:05 QQiangren