mirror of
https://github.com/azaion/detections.git
synced 2026-06-21 11:01:08 +00:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d971612efa | |||
| 42f9e022cb | |||
| fce289cad9 | |||
| 1dff909e74 | |||
| 70b52c27b1 | |||
| 5be8e05d9c | |||
| cc691657a8 | |||
| 8934314b1b | |||
| 5f0a8a5dfe |
+3
-1
@@ -15,4 +15,6 @@ __pycache__
|
|||||||
.pytest_cache
|
.pytest_cache
|
||||||
.git
|
.git
|
||||||
*.md
|
*.md
|
||||||
scripts
|
scripts/*
|
||||||
|
!scripts/jetson/
|
||||||
|
!scripts/jetson/generate_int8_cache.py
|
||||||
|
|||||||
@@ -36,15 +36,25 @@ steps:
|
|||||||
from_secret: registry_token
|
from_secret: registry_token
|
||||||
commands:
|
commands:
|
||||||
- echo "$REGISTRY_TOKEN" | docker login "$REGISTRY_HOST" -u "$REGISTRY_USER" --password-stdin
|
- echo "$REGISTRY_TOKEN" | docker login "$REGISTRY_HOST" -u "$REGISTRY_USER" --password-stdin
|
||||||
- export TAG=${CI_COMMIT_BRANCH}-${TAG_SUFFIX}
|
|
||||||
- export BUILD_DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
|
||||||
- |
|
- |
|
||||||
|
RAW_BRANCH="$CI_COMMIT_BRANCH"
|
||||||
|
if [ -z "$RAW_BRANCH" ]; then RAW_BRANCH="$WOODPECKER_COMMIT_BRANCH"; fi
|
||||||
|
if [ -z "$RAW_BRANCH" ]; then RAW_BRANCH="$CI_COMMIT_REF"; fi
|
||||||
|
if [ -z "$RAW_BRANCH" ]; then RAW_BRANCH="$WOODPECKER_COMMIT_REF"; fi
|
||||||
|
if [ -z "$RAW_BRANCH" ]; then RAW_BRANCH="manual"; fi
|
||||||
|
SAFE_BRANCH=$(printf '%s' "$RAW_BRANCH" | sed 's#^refs/heads/##; s#^refs/tags/##; s#[^A-Za-z0-9_.-]#-#g; s#^-*##; s#-*$##')
|
||||||
|
if [ -z "$SAFE_BRANCH" ]; then SAFE_BRANCH="manual"; fi
|
||||||
|
TAG="$SAFE_BRANCH-$TAG_SUFFIX"
|
||||||
|
BUILD_DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
||||||
|
echo "RAW_BRANCH=$RAW_BRANCH"
|
||||||
|
echo "SAFE_BRANCH=$SAFE_BRANCH"
|
||||||
|
echo "TAG=$TAG"
|
||||||
docker build -f ${DOCKERFILE} \
|
docker build -f ${DOCKERFILE} \
|
||||||
--build-arg CI_COMMIT_SHA=$CI_COMMIT_SHA \
|
--build-arg CI_COMMIT_SHA=$CI_COMMIT_SHA \
|
||||||
--label org.opencontainers.image.revision=$CI_COMMIT_SHA \
|
--label org.opencontainers.image.revision=$CI_COMMIT_SHA \
|
||||||
--label org.opencontainers.image.created=$BUILD_DATE \
|
--label org.opencontainers.image.created=$BUILD_DATE \
|
||||||
--label org.opencontainers.image.source=$CI_REPO_URL \
|
--label org.opencontainers.image.source=$CI_REPO_URL \
|
||||||
-t $REGISTRY_HOST/azaion/detections:$TAG .
|
-t $REGISTRY_HOST/azaion/detections:$TAG .
|
||||||
- docker push $REGISTRY_HOST/azaion/detections:$TAG
|
docker push $REGISTRY_HOST/azaion/detections:$TAG
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
when:
|
||||||
|
- event: [manual]
|
||||||
|
evaluate: 'BUILD_JETSON_TRT104 == "1"'
|
||||||
|
|
||||||
|
labels:
|
||||||
|
platform: arm64
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: build-push-jetson-trt104
|
||||||
|
image: docker
|
||||||
|
environment:
|
||||||
|
REGISTRY_HOST:
|
||||||
|
from_secret: registry_host
|
||||||
|
REGISTRY_USER:
|
||||||
|
from_secret: registry_user
|
||||||
|
REGISTRY_TOKEN:
|
||||||
|
from_secret: registry_token
|
||||||
|
commands:
|
||||||
|
- echo "$REGISTRY_TOKEN" | docker login "$REGISTRY_HOST" -u "$REGISTRY_USER" --password-stdin
|
||||||
|
- |
|
||||||
|
RAW_BRANCH="$CI_COMMIT_BRANCH"
|
||||||
|
if [ -z "$RAW_BRANCH" ]; then RAW_BRANCH="$WOODPECKER_COMMIT_BRANCH"; fi
|
||||||
|
if [ -z "$RAW_BRANCH" ]; then RAW_BRANCH="$CI_COMMIT_REF"; fi
|
||||||
|
if [ -z "$RAW_BRANCH" ]; then RAW_BRANCH="$WOODPECKER_COMMIT_REF"; fi
|
||||||
|
if [ -z "$RAW_BRANCH" ]; then RAW_BRANCH="manual"; fi
|
||||||
|
SAFE_BRANCH=$(printf '%s' "$RAW_BRANCH" | sed 's#^refs/heads/##; s#^refs/tags/##; s#[^A-Za-z0-9_.-]#-#g; s#^-*##; s#-*$##')
|
||||||
|
if [ -z "$SAFE_BRANCH" ]; then SAFE_BRANCH="manual"; fi
|
||||||
|
TAG="$SAFE_BRANCH-arm-trt104"
|
||||||
|
BUILD_DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
||||||
|
echo "RAW_BRANCH=$RAW_BRANCH"
|
||||||
|
echo "SAFE_BRANCH=$SAFE_BRANCH"
|
||||||
|
echo "TAG=$TAG"
|
||||||
|
docker build -f Dockerfile.jetson.trt104 \
|
||||||
|
--build-arg CI_COMMIT_SHA=$CI_COMMIT_SHA \
|
||||||
|
--label org.opencontainers.image.revision=$CI_COMMIT_SHA \
|
||||||
|
--label org.opencontainers.image.created=$BUILD_DATE \
|
||||||
|
--label org.opencontainers.image.source=$CI_REPO_URL \
|
||||||
|
-t $REGISTRY_HOST/azaion/detections:$TAG .
|
||||||
|
docker push $REGISTRY_HOST/azaion/detections:$TAG
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
@@ -34,7 +34,11 @@ steps:
|
|||||||
echo "ERROR: fixtures/models/azaion.onnx is missing; cannot convert Jetson engine"
|
echo "ERROR: fixtures/models/azaion.onnx is missing; cannot convert Jetson engine"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
ls -lh fixtures/image_small.jpg fixtures/models/azaion.onnx
|
if [ ! -f fixtures/models/azaion.int8_calib.cache ]; then
|
||||||
|
echo "ERROR: fixtures/models/azaion.int8_calib.cache is missing; cannot verify INT8 Jetson conversion"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
ls -lh fixtures/image_small.jpg fixtures/models/azaion.onnx fixtures/models/azaion.int8_calib.cache
|
||||||
|
|
||||||
E2E_PROFILE=jetson \
|
E2E_PROFILE=jetson \
|
||||||
E2E_WAIT_FOR_ENGINE_ENABLED=1 \
|
E2E_WAIT_FOR_ENGINE_ENABLED=1 \
|
||||||
@@ -42,12 +46,16 @@ steps:
|
|||||||
E2E_LOG_TAIL=300 \
|
E2E_LOG_TAIL=300 \
|
||||||
bash run_test.sh tests/test_health_engine.py::TestHealthEngineStep03Warmed -rs
|
bash run_test.sh tests/test_health_engine.py::TestHealthEngineStep03Warmed -rs
|
||||||
|
|
||||||
|
if [ ! -f results/report.csv ]; then
|
||||||
|
echo "ERROR: results/report.csv is missing; cannot verify Jetson conversion warm-up result"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
if grep -qi 'skipped' results/report.csv; then
|
if grep -qi 'skipped' results/report.csv; then
|
||||||
echo "ERROR: Jetson conversion warm-up tests were skipped; no engine was produced"
|
echo "ERROR: Jetson conversion warm-up tests were skipped; no engine was produced"
|
||||||
cat results/report.csv
|
cat results/report.csv
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
bash scripts/publish_jetson_engine.sh
|
REQUIRE_INT8_ENGINE=1 bash scripts/publish_jetson_engine.sh
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
FROM nvcr.io/nvidia/tensorrt:24.09-py3-igpu
|
||||||
|
ARG CI_COMMIT_SHA=unknown
|
||||||
|
ENV AZAION_REVISION=$CI_COMMIT_SHA
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
python3 python3-pip python3-dev gcc \
|
||||||
|
libgl1 libglib2.0-0 \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
COPY requirements.txt requirements-jetson.txt ./
|
||||||
|
RUN pip3 install --no-cache-dir -r requirements-jetson.txt
|
||||||
|
COPY . .
|
||||||
|
RUN BUILD_TENSORRT_EXTENSIONS=1 python3 setup.py build_ext --inplace
|
||||||
|
ENV PYTHONPATH=/app/src
|
||||||
|
RUN adduser --disabled-password --no-create-home --gecos "" appuser \
|
||||||
|
&& mkdir -p /app/Logs \
|
||||||
|
&& chown -R appuser /app
|
||||||
|
USER appuser
|
||||||
|
EXPOSE 8080
|
||||||
|
CMD ["python3", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080"]
|
||||||
@@ -139,6 +139,21 @@ Already exists: `e2e/docker-compose.test.yml`. No changes needed — supports bo
|
|||||||
docker compose -f docker-compose.jetson.yml up
|
docker compose -f docker-compose.jetson.yml up
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### detections-jetson-trt104 (Dockerfile.jetson.trt104)
|
||||||
|
|
||||||
|
Experimental INT8 calibration image for Jetson Orin devices. It uses NVIDIA's TensorRT iGPU container:
|
||||||
|
|
||||||
|
| Aspect | Specification |
|
||||||
|
|--------|--------------|
|
||||||
|
| Base image | `nvcr.io/nvidia/tensorrt:24.09-py3-igpu` |
|
||||||
|
| TensorRT | TensorRT 10.4.0.26 |
|
||||||
|
| Purpose | Work around TensorRT 10.3 INT8 calibration failures such as `checkSanity.cpp::checkLinks` / `Graph::regions` internal errors |
|
||||||
|
|
||||||
|
Build/tag example:
|
||||||
|
```bash
|
||||||
|
docker build -f Dockerfile.jetson.trt104 -t <registry>/azaion/detections:dev-arm-trt104 .
|
||||||
|
```
|
||||||
|
|
||||||
## Image Tagging Strategy
|
## Image Tagging Strategy
|
||||||
|
|
||||||
| Context | Tag Format | Example |
|
| Context | Tag Format | Example |
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ services:
|
|||||||
- jetson
|
- jetson
|
||||||
build:
|
build:
|
||||||
context: ..
|
context: ..
|
||||||
dockerfile: Dockerfile.jetson
|
dockerfile: ${JETSON_DOCKERFILE:-Dockerfile.jetson}
|
||||||
runtime: nvidia
|
runtime: nvidia
|
||||||
depends_on:
|
depends_on:
|
||||||
- mock-loader
|
- mock-loader
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ COMPOSE="${COMPOSE:-docker compose -f docker-compose.test.yml --profile jetson}"
|
|||||||
REGISTRY_HOST="${REGISTRY_HOST:?REGISTRY_HOST is required}"
|
REGISTRY_HOST="${REGISTRY_HOST:?REGISTRY_HOST is required}"
|
||||||
ENGINE_REPOSITORY="${JETSON_ENGINE_REPOSITORY:-$REGISTRY_HOST/azaion/detections-jetson-engine}"
|
ENGINE_REPOSITORY="${JETSON_ENGINE_REPOSITORY:-$REGISTRY_HOST/azaion/detections-jetson-engine}"
|
||||||
BRANCH="${CI_COMMIT_BRANCH:-local}"
|
BRANCH="${CI_COMMIT_BRANCH:-local}"
|
||||||
ENGINE_TAG="${JETSON_ENGINE_TAG:-$(printf '%s' "$BRANCH" | tr -c 'A-Za-z0-9_.-' '-')}"
|
default_tag="$(printf '%s' "$BRANCH" | sed 's#^refs/heads/##; s#^refs/tags/##; s#[^A-Za-z0-9_.-]#-#g; s#^-*##; s#-*$##')"
|
||||||
|
default_tag="${default_tag:-local}"
|
||||||
|
ENGINE_TAG="${JETSON_ENGINE_TAG:-$default_tag}"
|
||||||
OUT_DIR="${JETSON_ENGINE_OUT_DIR:-results/jetson-engine}"
|
OUT_DIR="${JETSON_ENGINE_OUT_DIR:-results/jetson-engine}"
|
||||||
|
|
||||||
mkdir -p "$OUT_DIR/models"
|
mkdir -p "$OUT_DIR/models"
|
||||||
@@ -26,6 +28,15 @@ if [[ "$engine_count" == "0" ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ "${REQUIRE_INT8_ENGINE:-0}" == "1" ]]; then
|
||||||
|
int8_engine_count="$(find "$OUT_DIR/models" -maxdepth 1 -type f -name 'azaion*.int8.engine' | wc -l | tr -d ' ')"
|
||||||
|
if [[ "$int8_engine_count" == "0" ]]; then
|
||||||
|
echo "ERROR: INT8 engine is required, but no azaion*.int8.engine file was produced"
|
||||||
|
find "$OUT_DIR/models" -maxdepth 1 -type f -name 'azaion*.engine' -print -exec ls -lh {} \;
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
echo "--- Converted TensorRT engine files:"
|
echo "--- Converted TensorRT engine files:"
|
||||||
find "$OUT_DIR/models" -maxdepth 1 -type f -name 'azaion*.engine' -print -exec ls -lh {} \;
|
find "$OUT_DIR/models" -maxdepth 1 -type f -name 'azaion*.engine' -print -exec ls -lh {} \;
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,9 @@ fi
|
|||||||
|
|
||||||
ENGINE_REPOSITORY="${JETSON_ENGINE_REPOSITORY:-$REGISTRY_HOST/azaion/detections-jetson-engine}"
|
ENGINE_REPOSITORY="${JETSON_ENGINE_REPOSITORY:-$REGISTRY_HOST/azaion/detections-jetson-engine}"
|
||||||
BRANCH="${CI_COMMIT_BRANCH:-local}"
|
BRANCH="${CI_COMMIT_BRANCH:-local}"
|
||||||
ENGINE_TAG="${JETSON_ENGINE_TAG:-$(printf '%s' "$BRANCH" | tr -c 'A-Za-z0-9_.-' '-')}"
|
default_tag="$(printf '%s' "$BRANCH" | sed 's#^refs/heads/##; s#^refs/tags/##; s#[^A-Za-z0-9_.-]#-#g; s#^-*##; s#-*$##')"
|
||||||
|
default_tag="${default_tag:-local}"
|
||||||
|
ENGINE_TAG="${JETSON_ENGINE_TAG:-$default_tag}"
|
||||||
TARGET_DIR="${JETSON_ENGINE_TARGET_DIR:-fixtures/models}"
|
TARGET_DIR="${JETSON_ENGINE_TARGET_DIR:-fixtures/models}"
|
||||||
image="$ENGINE_REPOSITORY:$ENGINE_TAG"
|
image="$ENGINE_REPOSITORY:$ENGINE_TAG"
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ def video_events(warm_engine, http_client, auth_headers):
|
|||||||
"X-Channel-Id": channel_id,
|
"X-Channel-Id": channel_id,
|
||||||
"X-Filename": "video_test01.mp4",
|
"X-Filename": "video_test01.mp4",
|
||||||
"X-Config": json.dumps(
|
"X-Config": json.dumps(
|
||||||
{"model_batch_size": 1, "frame_period_recognition": 100}
|
{"model_batch_size": 1, "frame_period_recognition": 4}
|
||||||
),
|
),
|
||||||
"Content-Type": "application/octet-stream",
|
"Content-Type": "application/octet-stream",
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user