100 Commits

Author SHA1 Message Date
3e144c2eb6 Tag for OSS fund 2024-10-18 11:16:37 +08:00
33048e8c48 include BlazeNetBenchmark in list
Signed-off-by: Ayase Minori <ayane@vignetteapp.org>
2024-04-06 22:09:53 +08:00
025c377c1b Add Macro benchmark
Signed-off-by: Ayase Minori <ayane@vignetteapp.org>
2024-04-06 22:07:08 +08:00
f25b832c06 Ensure ConsoleLogger is added as default logger
Signed-off-by: Ayase Minori <ayane@vignetteapp.org>
2024-03-30 22:17:23 +08:00
c2e0505e33 Ensure Memory usage and measurements are exported
Signed-off-by: Ayase Minori <ayane@vignetteapp.org>
2024-03-30 22:06:59 +08:00
6c4654b17f Add ImageFramePacket benchmark
This is based from our test case, could add an actual image later

Signed-off-by: Ayase Minori <ayane@vignetteapp.org>
2024-03-30 21:54:45 +08:00
9ac8cc297b Add benchmarking project for performance analysis
Will be useful later on as we cross-compare implementations when there's new improvements

Signed-off-by: Ayane <ayane@vignetteapp.org>
2024-03-25 13:08:48 +08:00
a5636b7d6a Add first example
Signed-off-by: Ayane <ayane@vignetteapp.org>
2023-04-25 08:18:37 +08:00
6a4d657916 0.9.2
Signed-off-by: Ayane Satomi <ayane@vignetteapp.org>
0.9.2
2023-04-16 07:35:40 +08:00
baf3fbd8ea Fix CLR objects not being set as ptr owner (#55)
Signed-off-by: Ayane Satomi <ayane@vignetteapp.org>
2023-04-16 07:30:02 +08:00
176415561c Fix incorrect path for test reporting
Signed-off-by: GitHub <noreply@github.com>
2023-03-12 08:15:35 +00:00
baf61c75da Install missing dotnet TFM in base images
Signed-off-by: GitHub <noreply@github.com>
2023-03-12 08:07:14 +00:00
57834c9c66 augh 2023-03-09 15:42:04 +08:00
06ffad9b48 augh
Signed-off-by: Ayane <ayane@vignetteapp.org>
2023-03-09 12:26:06 +08:00
2e53574f29 0.9.1
Signed-off-by: Ayane <ayane@vignetteapp.org>
0.9.1
2023-03-09 11:39:36 +08:00
346e5ae086 Remove unused directive
Signed-off-by: Ayane <ayane@vignetteapp.org>
2023-03-09 11:15:52 +08:00
234fd8305e Fix ImageFramePacket.Get trying to get a handle that it doesn't own
Signed-off-by: Ayane <ayane@vignetteapp.org>
2023-02-28 14:27:13 +08:00
7289277679 This did not commit AUGHHH
Signed-off-by: Ayane <ayane@vignetteapp.org>
2023-02-28 13:09:16 +08:00
b50e3da95f Remove unsafe constructor
Signed-off-by: Ayane <ayane@vignetteapp.org>
2023-02-28 13:02:11 +08:00
29ddcc5696 Give VoidDeleter a UnamangedCallersOnly attrib
Signed-off-by: Ayane <ayane@vignetteapp.org>
2023-02-28 12:40:12 +08:00
0edfd693eb Update to 0.9.1 (#46)
* Begin refactor

Signed-off-by: Ayane Satomi <ayane@vignetteapp.org>

* Begin IntPtr sweeping changes

Signed-off-by: Ayane Satomi <ayane@vignetteapp.org>

* Implement StringPacket

Signed-off-by: Ayane Satomi <ayane@vignetteapp.org>

* Implement StringPacket

Signed-off-by: Ayane Satomi <ayane@vignetteapp.org>

* Remove factory class to prepare for strongly typed packets

Signed-off-by: Ayane Satomi <ayane@vignetteapp.org>

* Finish FloatVectorPacket

Signed-off-by: Ayane <ayane@vignetteapp.org>

* Finish Anchor3DVectorPacket and BoolPacket

Signed-off-by: Ayane <ayane@vignetteapp.org>

* Make SerializedProto actually IDisposable

Signed-off-by: Ayane <ayane@vignetteapp.org>

* Finish ClassificationListPacket

Signed-off-by: Ayane <ayane@vignetteapp.org>

* Finish ClassificationListVectorPacket

Signed-off-by: Ayane <ayane@vignetteapp.org>

* Finish DetectionPacket

Signed-off-by: Ayane <ayane@vignetteapp.org>

* Finish DetectionVectorPacket

Signed-off-by: Ayane <ayane@vignetteapp.org>

* Finish FaceGeometryPacket

Signed-off-by: Ayane <ayane@vignetteapp.org>

* Finish FaceGeometryVectorPacket

Signed-off-by: Ayane <ayane@vignetteapp.org>

* Finish FloatArrayPacket

Signed-off-by: Ayane <ayane@vignetteapp.org>

* Fix mismatched extern call for FloatVector

This is potentially lethal and can cause a really bad bug on use

Signed-off-by: Ayane <ayane@vignetteapp.org>

* Finish FloatPacket

Signed-off-by: Ayane <ayane@vignetteapp.org>

* Finish FrameAnnotationPacket

Signed-off-by: Ayane <ayane@vignetteapp.org>

* Finish GpuBufferPacket

Converting the entirety of the GPU PInvoke code was also performed, it was unavoidable

Signed-off-by: Ayane <ayane@vignetteapp.org>

* Update imageFrame

This is kind of butchered but we will have a span-based overload again when I feel like it

Signed-off-by: Ayane <ayane@vignetteapp.org>

* Reintroduce the memory safe iamge handling again

Signed-off-by: Ayane <ayane@vignetteapp.org>

* Porting ImageFrame is an act of god ong

Signed-off-by: Ayane <ayane@vignetteapp.org>

* Finish ImageFramePacket

Signed-off-by: Ayane <ayane@vignetteapp.org>

* Finish IntPacket

Signed-off-by: Ayane <ayane@vignetteapp.org>

* Fix pointer ambiguity in MpResourceHandle

Signed-off-by: Ayane Satomi <ayane@vignetteapp.org>

* Let MpResourceHandle use its private property handle

Signed-off-by: Ayane Satomi <ayane@vignetteapp.org>

* Finish LandmarkListPacket

Signed-off-by: Ayane <ayane@vignetteapp.org>

* Finish LandmarkListVectorPacket

Signed-off-by: Ayane <ayane@vignetteapp.org>

* Finish NoramlizedLandmarkListPacket

Signed-off-by: Ayane <ayane@vignetteapp.org>

* Finish MatrixPacket

Signed-off-by: Ayane <ayane@vignetteapp.org>

* Finish NormalizedRectPacket

Signed-off-by: Ayane <ayane@vignetteapp.org>

* Finish normalizedVectorRect

Signed-off-by: Ayane <ayane@vignetteapp.org>

* Finish RectPacket

Signed-off-by: Ayane <ayane@vignetteapp.org>

* Finsih RectVector

Signed-off-by: Ayane <ayane@vignetteapp.org>

* Finish all Packets

Signed-off-by: Ayane <ayane@vignetteapp.org>

* Fixup CalculatorGraph for generic Packet types

Signed-off-by: Ayane <ayane@vignetteapp.org>

* a

Signed-off-by: Ayane <ayane@vignetteapp.org>

* Deprecate Solutions class

As there is no maintainers for it, it doesn't seem worth keeping it for now. We will put it on it's own package instead

Signed-off-by: Ayane <ayane@vignetteapp.org>

* Forgot to commit this 💀

Signed-off-by: Ayane <ayane@vignetteapp.org>

* Fix more casting issues

Signed-off-by: Ayane <ayane@vignetteapp.org>

* Make sure native methods are marshaled properly

Signed-off-by: Ayane <ayane@vignetteapp.org>

* Update some tests

Signed-off-by: Ayane Satomi <ayane@vignetteapp.org>

* Add an even more memory safe ctor for ImageFrame

Signed-off-by: Ayane Satomi <ayane@vignetteapp.org>

* Fix tests lmao

Signed-off-by: Ayane Satomi <ayane@vignetteapp.org>

* Fix StringPacket not pointing to a ptr

Signed-off-by: Ayane Satomi <ayane@vignetteapp.org>

* Fix incorrect test facts provided on cases

Signed-off-by: Ayane Satomi <ayane@vignetteapp.org>

---------

Signed-off-by: Ayane Satomi <ayane@vignetteapp.org>
Signed-off-by: Ayane <ayane@vignetteapp.org>
2023-02-22 14:01:27 +08:00
9291052f65 Update README.md 2023-02-19 07:57:46 +08:00
6e22b73a21 Update runtime 2023-02-14 18:04:57 +08:00
2b4c0556c1 update workflows to use v3 2023-02-14 04:48:15 +00:00
5e974f91b1 Change and update version spec 2023-02-14 12:38:22 +08:00
e5d0ad2f55 Update devcontainer.json 2023-02-14 10:41:17 +08:00
d54c47c509 Synchronise Project with Template 2022-12-19 18:11:08 +08:00
b5f3b54b15 Huge update to get on par with MediaPipeUnityPlugin (#39)
* Use new MediaPipe packages and update version

* Apply updates from MediaPipeUnityPlugin

All while keeping C pointers like `void*` instead of `IntPtr`
and various other practices.

* Add VSCode task to debug tests

* Fix unset freeHGlobal delegate

This can happen because the static code of the NativeMethods class
could have not run, for some reason...

* Fix all examples

* Fix import reordering
2022-07-30 14:37:17 +08:00
d562895694 Rewrite solutions (#33)
* Add paths for Linux in BlazePose example

* Add BlazePose example to VSCode debug launchers

* Use `pose_landmark` instead of `pose_tracking_*`

* Pluralize `SidePacket`

The correct way to call it is actually `SidePackets`,
as it is internally a `map<string, Packet>`.

* Little XML doc

* Consolidate `StartRun` method parameters

* Add `SidePackets` property to `Calculator`

* Add side packet arguments to `BlazePose`

* Use the `pose_tracking` graph

Let's try specifying side packets there instead.

* Use asynchronous SeeShark frame input

Looks like that doesn't fix the FPS...

* Remove unnecessary `unsafe`

* Better error handling in example program

* Uncomment additional SidePacket

* Implement new Packet API

* Rename `Packet` namespace to `OldPacket`

* Rename `NewPacket` namespace to `Packet`

* Actually, `Packets` is better...

* Delete old Packet API

* Replace Calculators with Solutions

Solutions are written in a way to imitate the
MediaPipe Python API as much as possible.

* Remove Old Packet API tests

* Fix remaining tests

* No more `SignalAbort` :0

* Revert "No more `SignalAbort` :0"

This reverts commit dd63b53fb53590560188d652346130ff31c74c62.

* Create `FaceMeshCpuSolution`

* Add interface

* Temporarily remove non-compiling example projects

* This solution produces segfaults...

* Create `PacketType` enum

Store packet outputs instead of packets in solution
No segfault now :D

* Use an `IDictionary` for outputs

* Create a `Hands` example

* Hand tracking is 10 times slower...

* No threading T-T

* Add `FaceMeshGpu` solution

* Avoid `free(): invalid pointer` error

* Implement `HandsGpu` solution

It works perfectly fine :D

* Start reimplementing Pose example

* Pose landmarks CPU (it's very slow)

* Just correcting some things in the examples

* Implement `PoseGpuSolution` (it's decently fast)

* `OsuFrameworkVisualTests` example works too

Though we need a way to make solutions multithreaded.

* Attempt at thread-safe `Solution` implementation

* There is no thread-safe solution. :')

This reverts commit 6e9ccca3deebf3ca74ed25c41e619c07c5febd94.

* Fix duplicate project in solution

How the fuck did that happen???
2022-07-25 23:53:06 +08:00
0388ceaa40 fix incorrect ImageFrame memory ownership handling (#29)
* fix incorrect ImageFrame memory ownership handling

* Update runtime package

* Fix PInvoke method name

* Clean ImageFrame code

* Update ImageFrameTest

* Update Mediapipe.Net package version

* Make osu!framework asynchronous

This is to compensate for the performance drop instated by this PR.
Other examples can stay as-is.
Fortunately Mediapipe handles asynchronous code perfectly well.

* Fix linting

Co-authored-by: Speykious <speykious@gmail.com>
2022-03-22 01:44:47 +08:00
8307a5bd7c Readme: add Discord and Nuget badges 2022-03-20 18:45:27 +01:00
a95e179d80 Working BlazePose example (#28)
* Make ImageFrame nullable, because BlazePose can return empty frames

* Add BlazePose example

Co-authored-by: Darren <darren@velogicfit.com>
2022-03-15 13:59:57 +08:00
0f116b41bb Fix dotnet not including packages 2022-03-13 11:14:35 +00:00
b5533ea49a Add NuGet Property group
Signed-off-by: GitHub <noreply@github.com>
2022-03-13 10:50:37 +00:00
a099ea939f Refactor resource provider (#27)
* These pointers are C++ strings, not C strings

* Create a `DummyResourceManager` as an example

* Hide unsafe APIs

* Oops

* Using a `Span` results in segfaults :(

* Handle exceptions in `provideResource`

* Remove stray comment

* Document the delegates

Co-authored-by: Ayane Satomi <ayane@vignetteapp.org>
0.8.9
2022-03-11 14:52:33 +01:00
ec44eb0673 Fix deleter (#26) 2022-03-04 16:38:37 +01:00
9dcb9c3492 Make Calculator more thread-safe (#25)
* YEP implement @LeNitrous 's suggestion

* lock

* Fix stream handle nullable issue

* Holistic calculators

Co-authored-by: Speykious <speykious@gmail.com>
2022-03-04 16:34:25 +01:00
cc7ed1ebd0 Fix critical memory leak (#22)
* fix examples (or at least try to)

* stuff

* Better dispose that

* Add video input options because I'm selfish

* THIS ONE MOTHERFUCKING FOR LOOP

* Remove unnecessary using

* Fix osu framework example

* Use stable `Google.Protobuf` package

* Add options to osu framework example

* Use same options on all examples

* Add framerate option

* Use framerate option

Co-authored-by: Speykious <speykious@gmail.com>
2022-02-21 17:07:15 +01:00
d0bbbe4895 Let examples use the new safe constructor 2022-02-02 17:19:56 +01:00
ce85bd59a4 Add a safe overload for ImageFrame() (#20)
* Add a safe overload for ImageFrame()

Signed-off-by: GitHub <noreply@github.com>

* Reduce code dup by wrapping into the unsafe overload instead

Signed-off-by: GitHub <noreply@github.com>

* dotnet format

Signed-off-by: GitHub <noreply@github.com>

* Le unhaskellize

🖑Hey🖐 buddy,👬 I think🤔 you've 👉got the 🛇wrong🚫 door🚪 the 🐄leather🐄 club's ♴two♴ blocks down☟. 🖕Fuck🖕↗You↘.Oh, Fuck♂You 🐄leather🐄 man Maybe 👬you and I👬 should settle it💪 👇right here👇 on the 💍ring💍 if you think🤔 your so 💪tough💪. Oh yea?😡 I'll kick👣 your ass!👊 Ha!😂 Yeah right👍 man. Let's go!✔ Why don't you🤔 get out of that 🐄leather stuff?🐄 I'll strip👙 down☟ out of this and we'll settle👪 it right here👇 in the ring. What do you say? 🤐Yeah⁉ no problem buddy👬 You got it. 🖒Get out of that uh, jabroni outfit👕👔👖. Yeah, smart🤔 ass. I'll show😡you who's the ☝boss☝ of this 🏋gym.🏋

Signed-off-by: GitHub <noreply@github.com>

* I'll let this Le pass this time

Co-authored-by: Speykious <speykious@gmail.com>
2022-02-02 16:36:42 +01:00
ff98083149 No reason for it to be like that 2022-02-02 11:21:45 +01:00
73cd0429f8 Create README.md
Signed-off-by: Ayane Satomi <chinodesuuu@gmail.com>
2022-01-29 12:37:39 +00:00
7777028aec The Vignette Authors™️ 2022-01-28 12:07:37 +01:00
0a65d1e5eb Useless changes or something idk 2022-01-28 11:48:47 +01:00
1ab4a85643 Remove duplicate style check on CI 2022-01-28 10:57:17 +01:00
3371a2e745 Replace slow Marshal operations with unsafe (#13)
* Remove this bool marshal

* Literally remove all bool marshals

* Remove CharSet.Unicode warning

* Remove most FunctionPtr marshals

* Remove `[return: MarshalAs(...)]`

* Replace all `IntPtr`s with `void*`s

* Replace all `void*.Zero`s with `null`s

* Make native method classes unsafe

* U N S A F E

* Replace `PtrToStructure` with pointer arithmetic

* Run `dotnet format`

* Temp ugly Activator fix

* Remove `.ToPointer()`

* Use `byte` to return a `bool`

* Backwards compatibility with `Activator`

Yeah that sucks :(

* Replace `Marshal.Copy` by pointer arithmetic

* Replace `PtrToStringAnsi()` with `new string()`

* Remove unnecessary usings

* Explicitly type string pointers as `sbyte*`

* It actually doesn't hang?

* `MediaPipeException` -> `MediapipeException`

* Simplify `for` loops

* Remove unnecessary `float*` cast

* Some more explicit types for `ImageFrame`

* Remove unnecessary cast

* Looks like we forgor a `using` 💀

* Create `SafeArrayCopy` helper method

* Document `SafeArrayCopy`
2022-01-28 10:53:30 +01:00
b56693a010 #pragma warning disable IDE0051 2022-01-27 17:13:13 +01:00
858d9d145c Add abstracted graphs + examples (#10)
* yep

* yep fix namespaces

* add gpu face mesh

* include path

* add example

* Configure VSCode debugging for the example

* Runtime arguments are overkill it seems

* Fix linting

* Fix linting (and my brain)

* fix issue

* yeppers

* You think it's funny to take screenshots of people's NFTs, huh?

Property theft is a joke to you? I'll have you know that the blockchain doesn't lie. I own it. Even if you save it, it's my property. You are mad that you don't own the art that I own.  Delete that screenshot.

* add BlazePose

* fix tiny skill issue

* fix using issue

* add hand and holistic calculators

* fix hand graph issue

* stuff

* Format all the stuff

* Create `CpuCalculator`

While leaving a kind of mess lol

* Create `GpuCalculator`

Poggers, but in parallel

* More graphs

* yep example

* Create new o!f visual tests example project

* Use the Superior target framework

* questioning the use of a questionable question mark

* pls halp

* Ignore `mediapipe/` folder for tests and examples

* Add GPU example to VSCode

* property

* change null frame exception message

Co-authored-by: Ayane <ayane@vignetteapp.org>

* `SupportedOSPlatform`: Case consistency

* Fix file encoding

* visual test

* Actuall close the graphs when disposing

* Fix `.csproj` file consistency

* Fix formatting and linting on `MediapipeDrawable`

* Fix `MediapipeDrawable` not showing

* Use a span instead of copying

* At least it disposes now...

* Round the corners of `MediapipeDrawable`

* remove unnecessary check

* increase drawable size and fill mode

* use consistent spacing

* oops

* Just a bit of formatting

and use `using` for the output image frame

* GPU WORKSWITH THIS ONE SIMPLE TRICK

LEARN HOW HE MADE BILLIONS OF DOLLARS WITH ONLY ONE LINE OF CODE

* dispose everywhere then

* add basic xmldoc

* fix lagnguage

* remove unnecessary nullable

* fix issue

* add new constructor

* Cleanup constructors

* fix xmldoc

* This is a better way to do it

* Create base `Calculator` class

* Delete `ICalculator` interface

* Polish XML doc

Also fix the stupid 💀

* Make all child calculators sealed

* Add `SupportedOSPlatform`

Can't add "Android" because some `Console` methods are unsupported

* Remove tmate debug from CI

* Polish examples more

I'm a perfectionist...?

Co-authored-by: Speykious <speykious@gmail.com>
Co-authored-by: Ayane <ayane@vignetteapp.org>
2022-01-24 18:01:22 +01:00
54b990081f Replace methods with C# getters/setters (#11)
* timestamp

* ImageFrame + tests

* whitespace

* stream poller

* fix issue

* gpu

* core

* status
2022-01-23 02:17:36 +08:00
de5c153e2a Tiny refactorization 2022-01-21 11:22:22 +01:00