Skip to content

Commit 46713fd

Browse files
committed
Merge branch 'main' into prepostprocess
2 parents 28872bc + a41f064 commit 46713fd

53 files changed

Lines changed: 12051 additions & 12 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/docker.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#
2+
name: Docker Build
3+
4+
# Configures this workflow to run every time a change is pushed to the branch called `release`.
5+
on:
6+
push:
7+
branches: ['main']
8+
9+
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
10+
env:
11+
REGISTRY: ghcr.io
12+
IMAGE_NAME: ${{ github.repository }}
13+
14+
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
15+
jobs:
16+
build-and-push-image:
17+
runs-on: ubuntu-latest
18+
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
19+
permissions:
20+
contents: read
21+
packages: write
22+
attestations: write
23+
id-token: write
24+
#
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
with:
29+
submodules: recursive
30+
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
31+
- name: Log in to the Container registry
32+
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
33+
with:
34+
registry: ${{ env.REGISTRY }}
35+
username: ${{ github.actor }}
36+
password: ${{ secrets.GITHUB_TOKEN }}
37+
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
38+
- name: Extract metadata (tags, labels) for Docker
39+
id: meta
40+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
41+
with:
42+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
43+
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
44+
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
45+
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
46+
- name: Build and push Docker image
47+
id: push
48+
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
49+
with:
50+
context: .
51+
push: true
52+
tags: ${{ steps.meta.outputs.tags }}
53+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/singularity.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Singularity Build
2+
on:
3+
push:
4+
5+
# Edit the branches here if you want to change deploy behavior
6+
branches:
7+
- main
8+
9+
# Do the builds on all pull requests (to test them)
10+
pull_request: []
11+
12+
jobs:
13+
build-test-containers:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
# Keep going on other deployments if anything bloops
17+
fail-fast: false
18+
matrix:
19+
singularity_version:
20+
- '3.8.1'
21+
22+
container:
23+
image: quay.io/singularity/singularity:v${{ matrix.singularity_version }}
24+
options: --privileged
25+
26+
steps:
27+
28+
- name: Check out code for the container builds
29+
uses: actions/checkout@v2
30+
with:
31+
submodules: recursive
32+
33+
- name: Build Container
34+
run: |
35+
if [ -f Singularity ]; then
36+
sudo -E singularity build container.sif Singularity
37+
else
38+
echo "Singularity is not found."
39+
echo "Present working directory: $PWD"
40+
ls
41+
fi
42+
43+
- name: Set Tag Based on Branch Name
44+
run: |
45+
# Get the branch name and set it as the tag
46+
tag=${GITHUB_REF##*/}-singularity
47+
echo "Tag is $tag."
48+
echo "tag=$tag" >> $GITHUB_ENV
49+
50+
- name: Login and Deploy Container
51+
if: (github.event_name != 'pull_request')
52+
run: |
53+
echo ${{ secrets.GITHUB_TOKEN }} | singularity remote login -u ${{ secrets.GHCR_USERNAME }} --password-stdin oras://ghcr.io
54+
container_name=$(echo ${GITHUB_REPOSITORY} | tr '[:upper:]' '[:lower:]')
55+
singularity push container.sif oras://ghcr.io/${container_name}:${tag}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,6 @@ cython_debug/
161161
*.out
162162
.vscode/settings.json
163163
*/core.*
164+
165+
# DynamicDet run files
166+
runs

.gitmodules

Lines changed: 0 additions & 4 deletions
This file was deleted.

Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM python:3.9.19-slim-bookworm
2+
3+
COPY pyproject.toml /opt/PartiNet/pyproject.toml
4+
COPY partinet /opt/PartiNet/partinet
5+
6+
RUN apt-get update && apt-get install libglib2.0-0 libxext6 libx11-6 -y && rm -rf /var/cache/apt/archives /var/lib/apt/lists/* && apt-get clean
7+
RUN python -m pip install --no-cache-dir --no-cache /opt/PartiNet
8+
9+
LABEL AUTHORS Mihin Perera, Edward Yang, Julie Iskander
10+
LABEL MAINTAINERS Mihin Perera, Edward Yang, Julie Iskander
11+
LABEL VERSION v0.1.1

README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ Options:
4747
Commands:
4848
detect
4949
preprocess
50+
test
5051
train
5152
```
5253

@@ -264,3 +265,62 @@ Options:
264265
```
265266

266267
TODO: more details...
268+
269+
## Testing
270+
271+
```bash
272+
partinet test --help
273+
```
274+
```
275+
Usage: partinet test [OPTIONS]
276+
277+
Options:
278+
--backbone-detector [yolov7|yolov7-w6|yolov7x]
279+
The choice of backbone to be used.
280+
[default: yolov7]
281+
--weight TEXT model.pt path(s) [required]
282+
--data TEXT data.yaml path [default: data/coco.yaml]
283+
--batch-size INTEGER total batch size for all GPUs [default: 1]
284+
--img-size INTEGER validation image size (pixels) [default:
285+
640]
286+
--conf-thres FLOAT object confidence threshold [default:
287+
0.001]
288+
--iou-thres FLOAT IOU threshold for NMS [default: 0.65]
289+
--task [train|val|test] train, val, test, speed or study [default:
290+
test]
291+
--device TEXT cuda device, i.e. 0 or 0,1,2,3 or cpu
292+
--single-cls train multi-class data as single-class
293+
--augment augmented inference
294+
--verbose report mAP by class
295+
--save-txt save results to *.txt
296+
--save-hybrid save label+prediction hybrid results to
297+
*.txt
298+
--save-conf save confidences in --save-txt labels
299+
--save-json save a cocoapi-compatible JSON results file
300+
--project TEXT save to project/name [default: runs/test]
301+
--name TEXT save to project/name [default: exp]
302+
--exist-ok existing project/name ok, do not increment
303+
--v5-metric assume maximum recall as 1.0 in AP
304+
calculation
305+
--dy-thres FLOAT dynamic thres [default: 0.5]
306+
--save-results save results
307+
--help Show this message and exit.
308+
```
309+
310+
TODO: more details...
311+
312+
## Get the container
313+
314+
Replace `partinet <subcommand> <args>` with one of the below:
315+
316+
### Docker
317+
318+
```bash
319+
docker run ghcr.io/wehi-researchcomputing/partinet:latest <subcommand> <args>
320+
```
321+
322+
### Singularity/Apptainer
323+
324+
```bash
325+
singularity run oras://ghcr.io/wehi-researchcomputing/partinet:latest <subcommand> <args>
326+
```

Singularity

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
bootstrap: docker
2+
from: python:3.9.19-slim-bookworm
3+
4+
%files
5+
. /opt/PartiNet
6+
7+
%post
8+
# install system dependencies
9+
apt-get update
10+
apt-get install libglib2.0-0 libxext6 libx11-6 -y
11+
12+
# cleanup apt package index
13+
rm -rf /var/cache/apt/archives /var/lib/apt/lists/*
14+
apt-get clean
15+
16+
python -m pip install --no-cache-dir /opt/PartiNet
17+
18+
%labels
19+
AUTHORS Mihin Perera, Edward Yang, Julie Iskander
20+
MAINTAINERS Mihin Perera, Edward Yang, Julie Iskander
21+
VERSION v0.1.1

partinet/DynamicDet

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)