mediapipe/docs/solutions/object_classification.md
Pierre Fenoll 1f121dd3eb CPU inference on desktop Linux with PyTorch v1.4.0
Signed-off-by: Pierre Fenoll <pierrefenoll@gmail.com>
2020-10-17 21:03:22 +02:00

2.6 KiB

layout title parent nav_order
default Object Classification Solutions TODO

MediaPipe Object Classification

{: .no_toc }

  1. TOC {:toc}

Example Apps

Note: To visualize a graph, copy the graph and paste it into MediaPipe Visualizer. For more information on how to visualize its associated subgraphs, please see visualizer documentation.

Desktop

Live Camera Input

Please first see general instructions for desktop on how to build MediaPipe examples.

Video File Input

  • With a PyTorch Model

    This uses a MobileNetv2 trace model from PyTorch Hub. To fetch and prepare it, run:

    python mediapipe/models/trace_mobilenetv2.py
    

    The pipeline is implemented in this graph.

    To build the application, run:

    bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/object_classification:object_classification_pytorch_cpu
    

    To run the application, replace <input video path> and <output video path> in the command below with your own paths:

    Tip: You can find a test video available in mediapipe/examples/desktop/object_detection.

    GLOG_logtostderr=1 bazel-bin/mediapipe/examples/desktop/object_classification/object_classification_pytorch_cpu \
      --calculator_graph_config_file=mediapipe/graphs/object_classification/object_classification_desktop_live.pbtxt \
      --input_side_packets=input_video_path=<input video path>,output_video_path=<output video path>