Skip to content

Conversation

@FelonEkonom
Copy link
Member

No description provided.

@FelonEkonom FelonEkonom requested a review from mat-hek November 24, 2025 16:29
@FelonEkonom FelonEkonom moved this from In Progress to In Review in Smackore Nov 24, 2025
@FelonEkonom FelonEkonom removed the request for review from mat-hek November 24, 2025 16:30
@FelonEkonom FelonEkonom requested a review from mat-hek November 24, 2025 16:59
Copy link
Member

@mat-hek mat-hek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Examples aren't adjusted to changes in the raw video format


# Created by https://www.gitignore.io/api/c,vim,linux,macos,elixir,windows,visualstudiocode
# Edit at https://www.gitignore.io/?templates=c,vim,linux,macos,elixir,windows,visualstudiocode
# Edit at https://www.gitignore.io/?yolos=c,vim,linux,macos,elixir,windows,visualstudiocode
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xd

@mat-hek mat-hek self-requested a review November 26, 2025 14:16
@@ -0,0 +1,337 @@
# Membrane YOLO Plugin demos

```elixir
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can add this, so there's better chance that cargo is found and Ortex compiles on Mac

Suggested change
```elixir
```elixir
System.put_env("PATH", "/opt/homebrew/bin:#{System.get_env("PATH")}")

## Download fixtures and model

```elixir
tmp_dir = System.tmp_dir!()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use a subdir, such as tmp_dir/membrane_yolo_examples


classes_path = tmp_dir |> Path.join("coco_classes.json")

classes_json = """
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we're downloading model and samples, we can download classes.json as well


<!-- livebook:{"branch_parent_index":0} -->

## Live objec detection on a stream from the comptuer camera
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Live objec detection on a stream from the comptuer camera
## Live object detection on a stream from the local camera

end
```

... and run it. After up to few seconds a player showing the stream with bouncing boxes should appear.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mention that the player window may be not visible

Comment on lines +69 to +85
defp maybe_draw_boxes(buffer, detected_objects, state) do
case state.draw_boxes do
false ->
%Membrane.Buffer{
buffer
| metadata: Map.put(buffer.metadata, :detected_objects, detected_objects)
}

draw_fun when is_function(draw_fun, 2) ->
{:ok, image} =
Membrane.RawVideo.payload_to_image(buffer.payload, state.stream_format)

image = draw_fun.(image, detected_objects)
{:ok, new_payload, _stream_format} = Membrane.RawVideo.image_to_payload(image)
%Membrane.Buffer{buffer | payload: new_payload}
end
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is duplicated between the offline and live filter. We can make the function public

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if it's worth having a separate offline filter. It's just the live filter but we wait until a buffer is processed each time. We could have a mode: :live | :offline option instead

function from [kino_yolo](https://github.com/poeticoding/kino_yolo)
"""
],
additional_latency: [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it shouldn't be the responsibility of this element, we could have a separate filter that would just add latency and would be usable in all cases like this

Comment on lines +1 to +20
# defmodule Membrane.YOLO.Utils do
# @moduledoc false

# @spec draw_boxes_or_update_metadata(
# buffer :: Membrane.Buffer.t(),
# detected_objects :: [map()],
# draw_boxes :: false | (Vix.Vips.Image.t(), [map()] -> Vix.Vips.Image.t())
# ) :: Membrane.Buffer.t()

# def draw_boxes_or_update_metadata(buffer, detected_objects, false) do
# metadata = buffer.metadata |> Map.put(:detected_objects, detected_objects)
# %Membrane.Buffer{buffer | metadata: metadata}
# end

# def draw_boxes_or_update_metadata(buffer, detected_objects, draw_fun)
# when is_function(draw_fun, 2) do
# new_payload = draw_fun.(buffer.payload, detected_objects)
# %Membrane.Buffer{buffer | payload: new_payload}
# end
# end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔

Comment on lines +44 to +45
The simplest way to draw boxes is to pass `KinoYOLO.Draw.draw_detected_objects/2`
function from [kino_yolo](https://github.com/poeticoding/kino_yolo)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIR we agreed to extract this from kino_yolo and improve colour contrast

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

3 participants