Update readme and setup docker image tagging
This commit is contained in:
parent
4dd1224679
commit
a3a128b7c4
3 changed files with 50 additions and 60 deletions
37
.github/workflows/docker-image.yml
vendored
37
.github/workflows/docker-image.yml
vendored
|
|
@ -4,6 +4,8 @@ on:
|
|||
branches:
|
||||
- docker
|
||||
- main
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
publish_images:
|
||||
|
|
@ -11,9 +13,32 @@ jobs:
|
|||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: build image
|
||||
run: docker build . -t arnaudcayrol/immich-selfie-timelapse:latest
|
||||
- name: push image to docker hub
|
||||
run: |
|
||||
docker login -u arnaudcayrol -p ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
docker push arnaudcayrol/immich-selfie-timelapse:latest
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: arnaudcayrol/immich-selfie-timelapse
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=ref,event=tag
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: arnaudcayrol
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
|
|
|||
73
README.md
73
README.md
|
|
@ -20,66 +20,31 @@ It uses the powerful machine learning features of Immich to gather all the photo
|
|||
- Discard photos where the subject is viewed from the side.
|
||||
- Adds timestamp in the filename for easy chronological ordering.
|
||||
|
||||
## Setup
|
||||
## Docker compose setup
|
||||
|
||||
1. **Generate an API Key in Immich:**
|
||||
- Log in to your Immich web UI.
|
||||
- Navigate to the API settings (or your profile settings) and generate an API key.
|
||||
- Copy the API key for use with the script.
|
||||
```yml
|
||||
services:
|
||||
immich-selfie-timelapse:
|
||||
image: arnaudcayrol/immich-selfie-timelapse
|
||||
container_name: immich-selfie-timelapse
|
||||
ports:
|
||||
- "5000:5000"
|
||||
volumes:
|
||||
- ./immich_selfie_timelapse:/app/output
|
||||
environment:
|
||||
- IMMICH_API_KEY=abcdefghijklmnopqrstuvwxyz
|
||||
- IMMICH_BASE_URL=http://192.168.1.94:2283/api
|
||||
```
|
||||
|
||||
2. **Find the Person ID:**
|
||||
- In the Immich web UI, view photos sorted by person.
|
||||
- When you click on a specific person, check the URL in your browser.
|
||||
- The person ID (usually a UUID) is part of the URL. Copy this ID for use in the script.
|
||||
Once the service is started, access the webpage to configure the tool: http://127.0.0.1:5000.
|
||||
|
||||
3. **Install Dlib python library**
|
||||
- Download the wheel for your python version here: https://github.com/z-mahmud22/Dlib_Windows_Python3.x
|
||||
- Install it with `python -m pip install dlib-19.24.99-cp312-cp312-win_amd64.whl`
|
||||
|
||||
5. **Download the face detection CNN model**
|
||||
- Download mmod_human_face_detector.dat from:
|
||||
https://github.com/justadudewhohacks/face-recognition.js-models/blob/master/models/mmod_human_face_detector.dat
|
||||
- Place the file in the same folder as the script, or update the predictor path in the script accordingly.
|
||||
|
||||
4. **Download the Face Landmark Data:**
|
||||
- Download the 68-point face landmark model from:
|
||||
https://github.com/italojs/facial-landmarks-recognition/blob/master/shape_predictor_68_face_landmarks.dat
|
||||
- Place the file in the same folder as the script, or update the predictor path in the script accordingly.
|
||||
|
||||
5. **Install the required python modules from requirements.txt**
|
||||
- Note that an old version of Numpy is required for compatibility with dlib.
|
||||
|
||||
## Usage
|
||||
|
||||
Run the script from the command line with the required arguments. For example:
|
||||
|
||||
python process_faces.py \
|
||||
--api-key YOUR_API_KEY \
|
||||
--base-url http://your.immich.server:2283/api \
|
||||
--person-id YOUR_PERSON_ID \
|
||||
--output-folder output
|
||||
|
||||
### Command-line Arguments
|
||||
|
||||
- **--api-key**: API key generated from Immich.
|
||||
- **--base-url**: Base URL of your Immich API (e.g., http://192.168.1.123:2283/api).
|
||||
- **--person-id**: The ID of the person (obtained from the Immich web UI).
|
||||
- **--output-folder**: Directory where the aligned face images will be saved (default: output).
|
||||
- **--padding-percent**: Padding added around the face as a percentage (default: 0.3).
|
||||
- **--resize-width** and **--resize-height**: Dimensions for the output image (default: 512 x 512).
|
||||
- **--min-face-width** and **--min-face-height**: Minimum acceptable face dimensions (default: 128 x 128).
|
||||
- **--pose-threshold**: Threshold for acceptable head pose.
|
||||
- **--desired-left-eye**: Desired left eye position as a fraction (x y) in the output image (default: 0.35 0.45).
|
||||
- **--max-workers**: Number of parallel processes to use (default: 4).
|
||||
- **--face-detect-model-paths**: Path to the CNN face detector model file (default: mmod_human_face_detector.dat).
|
||||
- **--landmark-model-path**: Path to the face landmark predictor model file (default: shape_predictor_68_face_landmarks.dat).
|
||||
<p align="center">
|
||||
<img src="resources/webpage.jpg" alt="Example GIF">
|
||||
</p>
|
||||
|
||||
## Additional Notes
|
||||
|
||||
- Ensure that the `shape_predictor_68_face_landmarks.dat` file is accessible by the script. Update the path if necessary.
|
||||
- The tool may require some manual sorting of the output images to achieve the best video effect. In particular, the face landmark detection is not super robust.
|
||||
- Execution speed: on my i5 11400, it can process about 2 image per second.
|
||||
- I find that a video framerate of 15 fps gives good results.
|
||||
- For best looking results, I still recommand a manual pass over the final image folder to remove some outliers. The face orientation detection is not perfect at all. Hopefully someday I can get a better results.
|
||||
- Contributions and improvements are welcome.
|
||||
|
||||
## License
|
||||
|
|
|
|||
BIN
resources/webpage.jpg
Normal file
BIN
resources/webpage.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 129 KiB |
Loading…
Reference in a new issue