Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
58 lines (46 loc) · 2.26 KB
/
Copy pathMakefile
File metadata and controls
58 lines (46 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
FP32_MODEL_PATH := models/u2net.onnx
FP32_MODEL_URL := https://github.com/danielgatis/rembg/releases/download/v0.0.0/u2net.onnx
FP32_MODEL_SHA256 := 8d10d2f3bb75ae3b6d527c77944fc5e7dcd94b29809d47a739a7a728a912b491
FACE_MODEL_PATH := models/face_detection_yunet_2023mar.onnx
FACE_MODEL_SHA256 := 8f2383e4dd3cfbb4553ea8718107fc0423210dc964f9f4280604804ed2552fa4
FOCALNET_MODEL_PATH := models/focalnet-human.onnx
FOCALNET_MODEL_URL := https://github.com/appwrite/focalnet/releases/download/2026-09-14-rc1/focalnet-human.onnx
FOCALNET_MODEL_TAG := 2026-09-14-rc1
FOCALNET_MODEL_SHA256 := 59164c601c98cea3f62b25166710831dac63e1a872fc64767c65316ad5385439
VERSION ?= dev
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown)
LDFLAGS := -X main.version=$(VERSION) -X main.commit=$(COMMIT)
.PHONY: build run test test-integration test-integration-fp32 evaluate model model-fp32 model-int8 model-face model-focalnet
build:
go build -ldflags="$(LDFLAGS)" -o autogravity ./cmd/autogravity
run: model
go run ./cmd/autogravity
test:
go test ./...
test-integration: model
go test -race -tags=integration ./...
test-integration-fp32: model-fp32 model-face
MODEL_PATH= MODEL_PRECISION=fp32 go test -race -tags=integration ./...
evaluate: model
go test -tags=integration,evaluation -run TestEvaluateDifficultScenes -v ./cmd/autogravity
model: model-fp32 model-int8 model-face
model-int8:
@echo "b340186f56660b6665e494aab912e5f8e9adbc2317181c77fd01aa226f06553b models/u2net-int8.onnx" | shasum -a 256 -c
model-face:
@echo "$(FACE_MODEL_SHA256) $(FACE_MODEL_PATH)" | shasum -a 256 -c
model-fp32:
@if [ ! -f "$(FP32_MODEL_PATH)" ]; then \
curl -fL --retry 3 -o "$(FP32_MODEL_PATH)" "$(FP32_MODEL_URL)"; \
fi
@echo "$(FP32_MODEL_SHA256) $(FP32_MODEL_PATH)" | shasum -a 256 -c
model-focalnet:
@if [ ! -f "$(FOCALNET_MODEL_PATH)" ]; then \
if command -v gh >/dev/null 2>&1 && gh release download "$(FOCALNET_MODEL_TAG)" --repo appwrite/focalnet --pattern focalnet-human.onnx --dir models --clobber; then \
true; \
else \
curl -fL --retry 3 -o "$(FOCALNET_MODEL_PATH)" "$(FOCALNET_MODEL_URL)"; \
fi; \
fi
@echo "$(FOCALNET_MODEL_SHA256) $(FOCALNET_MODEL_PATH)" | shasum -a 256 -c
@mkdir -p models/optional
@cp "$(FOCALNET_MODEL_PATH)" models/optional/focalnet-human.onnx