Introducing Google AI Edge Portal: Benchmark Edge AI at scale. Sign-up to request access during private preview.

Packets

Calculators communicate by sending and receiving packets. Typically a single packet is sent along each input stream at each input timestamp. A packet can contain any kind of data, such as a single frame of video or a single integer detection count.

Creating a packet

Packets are generally created with mediapipe::MakePacket<T>() or mediapipe::Adopt() (from packet.h).

// Create a packet containing some new data.
Packetp=MakePacket<MyDataClass>("constructor_argument");
// Make a new packet with the same data and a different timestamp.
Packetp2=p.At(Timestamp::PostStream());

or:

// Create some new data.
autodata=absl::make_unique<MyDataClass>("constructor_argument");
// Create a packet to own the data.
Packetp=Adopt(data.release()).At(Timestamp::PostStream());

Data within a packet is accessed with Packet::Get<T>()

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024年04月24日 UTC.