roboflow / inference

A fast, easy-to-use, production-ready inference server for computer vision supporting deployment of many popular model architectures and fine-tuned models.
https://inference.roboflow.com
Other
1.37k stars 129 forks source link

Hello, how does the local computer run to obtain the prediction label and detect the bbox coordinates? #334

Closed KingBoyAndGirl closed 7 months ago

KingBoyAndGirl commented 7 months ago

Search before asking

Question

Hello, how does the local computer run to obtain the prediction label and detect the bbox coordinates? The following is my code, please take a look at it for me, thank you very much (I am running on a local computer, do not use API KEY)::

from inference import InferencePipeline
from inference.core.interfaces.stream.sinks import VideoFileSink

video_sink = VideoFileSink.init(video_file_name="output.avi")

pipeline = InferencePipeline.init_with_yolo_world(
    video_reference="./video_1.mp4",
    classes=["person", "bicycle", "car", "motorcycle", "airplane", "bus", "train", "truck", "boat", "traffic light",
             "fire hydrant", "stop sign", "parking meter", "bench", "bird", "cat", "dog", "horse", "sheep", "cow",
             "elephant", "bear", "zebra", "giraffe", "backpack", "umbrella", "handbag", "tie", "suitcase", "frisbee",
             "skis", "snowboard", "sports ball", "kite", "baseball bat", "baseball glove", "skateboard", "surfboard",
             "tennis racket", "bottle", "wine glass", "cup", "fork", "knife", "spoon", "bowl", "banana", "apple",
             "sandwich", "orange", "broccoli", "carrot", "hot dog", "pizza", "donut", "cake", "couch",
             "potted plant", "bed", "dining table", "toilet", "tv", "laptop", "mouse", "remote", "keyboard",
             "cell phone", "microwave", "oven", "toaster", "sink", "refrigerator", "book", "clock", "vase", "scissors",
             "teddy bear", "hair drier", "toothbrush", "faucet", "Trash can", "chair", "Refrigerator"],
    model_size="s",
    on_prediction=video_sink.on_prediction,
)
# start the pipeline
pipeline.start()
# wait for the pipeline to finish
pipeline.join()

video_sink.release()

Additional

No response

PawelPeczek-Roboflow commented 7 months ago

Hi there In this particular case - YOLOWorld models and CLIP are pulled from our hosting. Then models are loaded and you run inference on each video frame. Is that answer your question?

KingBoyAndGirl commented 7 months ago

Hi there 你好呀 In this particular case - YOLOWorld models and CLIP are pulled from our hosting. Then models are loaded and you run inference on each video frame. 在这种特殊情况下 - YOLOWorld 模型和 CLIP 是从我们的托管中提取的。然后加载模型并对每个视频帧运行推理。 Is that answer your question? 这就是你的问题的答案吗?

Thank you for answering this question in your busy schedule. Excuse me, I also want to ask a question, if I want to get the prediction label and bbox coordinates, is there any other way? (note: I want to privatize the deployment, the data is not public, can this goal be achieved? )

PawelPeczek-Roboflow commented 7 months ago

On video. what you passed here on_prediction=video_sink.on_prediction - the video_sink.on_prediction gets prediction and may do whatever with it (substitute with lambda pred, video_frame: print(pred) to see predictions from a model.

If you ask about possibility to make prediction on another source than video: this documentation page illustrates the options.

KingBoyAndGirl commented 7 months ago

On video. what you passed here on_prediction=video_sink.on_prediction - the video_sink.on_prediction gets prediction and may do whatever with it (substitute with lambda pred, video_frame: print(pred) to see predictions from a model.在视频上。您在此处传递的内容 on_prediction=video_sink.on_prediction - video_sink.on_prediction 获取预测并可以对其执行任何操作(替换为 lambda pred, video_frame: print(pred) 以查看模型的预测。

If you ask about possibility to make prediction on another source than video: this documentation page illustrates the options.如果您询问是否可以对视频以外的其他来源进行预测:此文档页面说明了这些选项。

Thank you very much for your help and guidance.

PawelPeczek-Roboflow commented 7 months ago

Pleasure is all mine.