diff --git a/examples/1-basic-tutorial.livemd b/examples/1-basic-tutorial.livemd index f43c528..2671c18 100644 --- a/examples/1-basic-tutorial.livemd +++ b/examples/1-basic-tutorial.livemd @@ -5,7 +5,7 @@ ```elixir Mix.install( [ - {:ex_vision, path: Path.join(__DIR__, "..")}, + :ex_vision, :kino, :kino_bumblebee, :stb_image, @@ -33,7 +33,7 @@ The main objective of ExVision is ease of use. This sacrifices some control over ```elixir alias ExVision.Classification.MobileNetV3Small, as: Classifier -alias ExVision.Detection.Ssdlite320_MobileNetv3, as: Detector +alias ExVision.Detection.FasterRCNN_ResNet50_FPN, as: Detector alias ExVision.Segmentation.DeepLabV3_MobileNetV3, as: Segmentation {:ok, classifier} = Classifier.load() @@ -83,8 +83,12 @@ input = Kino.Input.image("Image to evaluate", format: :jpeg) ```elixir img_path = case Kino.Input.read(input) do - nil -> Path.join(__DIR__, "files/cat.jpg") - %{file_ref: image} -> Kino.Input.file_path(image) + nil -> + {:ok, file} = ExVision.Cache.lazy_get(ExVision.Cache, "cat.jpg") + file + + %{file_ref: image} -> + Kino.Input.file_path(image) end image = Image.open!(img_path) @@ -127,10 +131,7 @@ scored_list = Kino.Bumblebee.ScoredList.new(predictions) Kino.Layout.grid( [ - Kino.Layout.grid([ - image, - Kino.Text.new("This image shows an object of class `#{Atom.to_string(top_prediction)}`") - ]), + image, Kino.Layout.grid([Kino.Text.new("Class probabilities"), scored_list]) ], columns: 2, diff --git a/examples/2-usage-as-nx-serving.livemd b/examples/2-usage-as-nx-serving.livemd index 0e88a79..9019533 100644 --- a/examples/2-usage-as-nx-serving.livemd +++ b/examples/2-usage-as-nx-serving.livemd @@ -5,7 +5,7 @@ ```elixir Mix.install( [ - {:ex_vision, path: Path.join(__DIR__, "..")}, + :ex_vision, :exla, :kino, :nx, diff --git a/examples/3-membrane.livemd b/examples/3-membrane.livemd index 4430804..7ef62a1 100644 --- a/examples/3-membrane.livemd +++ b/examples/3-membrane.livemd @@ -5,7 +5,7 @@ ```elixir Mix.install( [ - {:ex_vision, path: Path.join(__DIR__, "..")}, + :ex_vision, :image, :membrane_core, :membrane_file_plugin, @@ -54,7 +54,7 @@ But before we dive into the code, here are a few tips that will make it both eas defmodule Membrane.ExVision.Detector do use Membrane.Filter - alias ExVision.Detection.FasterRCNN_ResNet50_FPN, as: Model + alias ExVision.Detection.Ssdlite320_MobileNetv3, as: Model alias ExVision.Types.BBox # Define both input and output pads @@ -161,11 +161,11 @@ defmodule Pipeline do use Membrane.Pipeline @impl true - def handle_init(_ctx, output_file) do + def handle_init(_ctx, {input_file, output_file}) do structure = child(%Membrane.File.Source{ chunk_size: 1024, - location: Path.join(__DIR__, "files/big-buck-bunny-short.mp4"), + location: input_file, seekable?: true }) |> child(:demuxer, %Membrane.MP4.Demuxer.ISOM{optimize_for_non_fast_start?: true}) @@ -210,7 +210,10 @@ We have written the Filter responsible for applying our model and the full proce ```elixir output_file = Path.join("/tmp", "#{DateTime.utc_now()}.mp4") -{:ok, _supervisor_pid, pipeline_pid} = Membrane.Pipeline.start(Pipeline, output_file) +{:ok, input_file} = ExVision.Cache.lazy_get(ExVision.Cache, "big-buck-bunny-short.mp4") + +{:ok, _supervisor_pid, pipeline_pid} = + Membrane.Pipeline.start(Pipeline, {input_file, output_file}) Kino.nothing() ``` diff --git a/examples/files/big-buck-bunny-short.mp4 b/examples/files/big-buck-bunny-short.mp4 deleted file mode 100644 index 80b85c2..0000000 Binary files a/examples/files/big-buck-bunny-short.mp4 and /dev/null differ diff --git a/examples/files/cat.jpg b/examples/files/cat.jpg deleted file mode 100644 index 9e4ee42..0000000 Binary files a/examples/files/cat.jpg and /dev/null differ diff --git a/examples/files/multipla.jpg b/examples/files/multipla.jpg deleted file mode 100644 index 73df52b..0000000 Binary files a/examples/files/multipla.jpg and /dev/null differ