]> git.djapps.eu Git - pkg/ggml/sources/ggml/commit
examples : add sample SAM inference (#74)
authorGeorgi Gerganov <redacted>
Fri, 18 Aug 2023 11:50:25 +0000 (14:50 +0300)
committerGitHub <redacted>
Fri, 18 Aug 2023 11:50:25 +0000 (14:50 +0300)
commit8da5be2ce52541dc1115b35a9df1c7e892d049d8
tree21a5889471d588c84b8fce3d7baee74eb0bcda43
parent7cf109e890bd31fad3ad5e4393e4856a3950ab1e
examples : add sample SAM inference (#74)

* sam : image + prompt encoder, store embeddings

* sam : add the dense img pe in SAM state (#401)

* Add SAM decoder & output masks as png (#418)

* Add loading of decoder layers in Model

* Multiply by hypernet_layer_cnt for ctx_size on model load

* Add decoder layers to py conversion script

* Fix wrong and reversed tensor sizes for decoder

* Add decoder transformer implementation

* Add decoder hypernet and iou prediction mlps

* Add transpose convolution operation and unit test

* Finish mask decoder and write the decoder output in the model state

* Output masks to png after removing padding and upsampling to original size

- Also filter based on the iou treshold
- Additionally filtering based on the stability score and crop boxes
should be done

* Add stb image write in order to output masks from SAM

* Add transpose convolution 2d name and symbol to ggml ops static arrays

* Comment out debug print in transpose convolution test to fix compilation

ggml-ci

* Multithread GGML_OP_ADD_REL_POS operation

* ggml : fix GGML_OP_NAME array

* Disable and comment out debug prints in SAM example

* Add README for the SAM example

* Calculate & filter based on stability score and calculate bounding box

ggml-ci

---------

Co-authored-by: Yavor Ivanov <redacted>
13 files changed:
examples/CMakeLists.txt
examples/common.cpp
examples/common.h
examples/sam/CMakeLists.txt [new file with mode: 0644]
examples/sam/README.md [new file with mode: 0644]
examples/sam/convert-pth-to-ggml.py [new file with mode: 0644]
examples/sam/main.cpp [new file with mode: 0644]
examples/stb_image.h [new file with mode: 0644]
examples/stb_image_write.h [new file with mode: 0644]
include/ggml/ggml.h
src/ggml.c
tests/CMakeLists.txt
tests/test-conv-transpose.c [new file with mode: 0644]