generated from AD-SDL/python_template_module
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
49feda4
commit 01e466d
Showing
13 changed files
with
732 additions
and
309 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: Docker Build and Publish | ||
|
||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
on: | ||
push: | ||
branches: [ "*" ] | ||
# Publish semver tags as releases. | ||
tags: [ '*' ] | ||
schedule: # Run on Tuesday's at noon | ||
- cron: '0 12 * * 2' | ||
|
||
env: | ||
# Use docker.io for Docker Hub if empty | ||
REGISTRY: ghcr.io | ||
# github.repository as <account>/<repo> | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
|
||
jobs: | ||
build_and_publish: | ||
|
||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
# Login against a Docker registry except on PR | ||
# https://github.com/docker/login-action | ||
- name: Log into registry ${{ env.REGISTRY }} | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Extract metadata (tags, labels) for Docker | ||
# https://github.com/docker/metadata-action | ||
- name: Extract Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: | | ||
type=schedule | ||
type=ref,event=branch | ||
type=ref,event=tag | ||
type=ref,event=pr | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
# Build and push Docker image with Buildx | ||
# https://github.com/docker/build-push-action | ||
- name: Build and push Docker image | ||
id: build-and-push | ||
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: linux/amd64,linux/arm64 | ||
#cache-from: type=gha | ||
#cache-to: type=gha,mode=max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,59 @@ | ||
FROM ghcr.io/ad-sdl/wei | ||
|
||
# TODO: update labels, if neccessary | ||
LABEL org.opencontainers.image.source=https://github.com/AD-SDL/object_detection_module | ||
LABEL org.opencontainers.image.description="A template python module that demonstrates basic WEI module functionality." | ||
LABEL org.opencontainers.image.description="A module that allows you to take a picture via webcam and run YOLO object detection through darknet" | ||
LABEL org.opencontainers.image.licenses=MIT | ||
|
||
######################################### | ||
# Module specific logic goes below here # | ||
######################################### | ||
|
||
RUN mkdir -p object_detection_module | ||
RUN apt-get update && \ | ||
apt-get install -y \ | ||
build-essential \ | ||
git \ | ||
libopencv-dev \ | ||
cmake \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN mkdir -p /root/src | ||
|
||
# Clone the Darknet repository | ||
RUN git clone https://github.com/hank-ai/darknet /root/src/darknet | ||
|
||
# Build Darknet | ||
WORKDIR /root/src/darknet | ||
|
||
RUN mkdir build && cd build && \ | ||
cmake -DCMAKE_BUILD_TYPE=Release .. && \ | ||
make -j4 package | ||
|
||
# Install Darknet package | ||
RUN dpkg -i build/darknet-*.deb | ||
|
||
WORKDIR /home/app | ||
|
||
RUN mkdir -p /home/app/trained | ||
|
||
COPY trainingImages /home/app/trained | ||
|
||
RUN mkdir -p /home/app/test | ||
|
||
COPY pic1.jpg /home/app/test | ||
|
||
RUN mkdir -p /home/app/object_detection_module | ||
|
||
COPY ./src object_detection_module/src | ||
RUN chmod +x object_detection_module/src/photoAndPosition.sh | ||
COPY ./README.md object_detection_module/README.md | ||
COPY ./pyproject.toml object_detection_module/pyproject.toml | ||
|
||
RUN --mount=type=cache,target=/root/.cache \ | ||
pip install ./object_detection_module | ||
pip install -e ./object_detection_module | ||
|
||
# TODO: Add any device-specific container configuration/setup here | ||
# CMD ["python", "-m", "object_detection_rest_node"] | ||
|
||
CMD ["python", "object_detection_module.py"] | ||
# Add user to video group to access camera | ||
RUN usermod -a -G video app | ||
|
||
######################################### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
[project] | ||
name = "object_detection_module" | ||
version = "0.0.0" | ||
description = "TODO: Add a description here" | ||
authors = [{name = "Ryan D. Lewis", email="[email protected]"}] # TODO: update authors list | ||
# TODO: Add additional python dependencies here | ||
version = "1.5.0" | ||
description = "A module that allows you to take a picture via webcam and run YOLO object detection through darknet" | ||
authors = [{name = "Pranav Sinha", email="[email protected]"}] | ||
dependencies = [ | ||
"fastapi>=0.103", | ||
"uvicorn>=0.14.0", | ||
"opencv-python-headless", | ||
"ad_sdl.wei", | ||
"pytest", | ||
"numpy<2" | ||
] | ||
requires-python = ">=3.9.1" | ||
requires-python = ">=3.8.1" | ||
readme = "README.md" | ||
license = {text = "MIT"} | ||
|
||
[project.urls] | ||
homepage = "https://github.com/AD-SDL/object_detection_module" | ||
homepage = "https://github.com/AD-SDL/python_template_module" | ||
|
||
##################### | ||
# Development Tools # | ||
|
36 changes: 0 additions & 36 deletions
36
src/object_detection_interface/object_detection_interface.py
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.