whitphx/streamlit-webrtc

Failed to get any callback frames to render

ElinLiu0 opened this issue · 1 comments

Hi,i'm trying to use NVIDIA Triton Inference Server and webRTC to build a detection app.
I have write the recv() function in VideoProcessor like below:

def recv(self,frame):
        inputs,outputs = [],[]
        frame = frame.to_ndarray(format="bgr24")
        image_data = self.preprocess(frame)
        inputs.append(httpclient.InferInput(self.inputName,image_data.shape,"FP32"))
        inputs[0].set_data_from_numpy(image_data)
        outputs.append(httpclient.InferRequestedOutput(self.outputName))
        try:
            results = self.inferenceClient.async_infer(
                model_name = self.modelName,
                inputs = inputs,
                outputs = outputs,
                model_version = self.modelVersion,
                request_id = str(random.random())
            )
            output = results.get_result().as_numpy(self.outputName)
            outputFrame = self.postprocess(frame,output)
            return av.VideoFrame.from_ndarray(outputFrame,format="bgr24")
        except InferenceServerException as e:
            return str(e)

Yet it doesn't render the callback frame on my app:
image
But i can prove that inference Server working fine,with the same code on opencv local reading script,it works fine:
output

So is there any way to deal with that?

Closed,this issue were Due to the different shooting angles in trainig set,then yolo model can't detect the object which front of camera