Jump to content

Tool:WikiVisage

From Wikitech
Toolforge tools
WikiVisage
Website https://WikiVisage.toolforge.org/
Description Active learning facial recognition for Wikimedia Commons
Keywords Commons, SDC, ML
Author(s) Premeditated
Maintainer(s) Premeditated (View all)
Source code GitHub
License MIT License
Issues TBA

WikiVisage is an active learning facial recognition for Wikimedia Commons. Train an ML model to recognize specific people and automatically add P180 (depicts) Structured Data to matching images.

See commons:WikiVisage for user documentation.

Deployment

Environment variables (Toolforge)
$ ssh login.toolforge.org
$ become wikivisage

# Database credentials (find yours in ~/replica.my.cnf on Toolforge)
$ toolforge envvars create TOOL_TOOLSDB_USER      "s<NNNNN>"
$ toolforge envvars create TOOL_TOOLSDB_PASSWORD  "<password>"
$ toolforge envvars create WIKIVISAGE_DB_NAME     "s<NNNNN>__wikiface"

# OAuth 2.0
$ toolforge envvars create OAUTH_CLIENT_ID        "<client-id>"
$ toolforge envvars create OAUTH_CLIENT_SECRET    "<client-secret>"
$ toolforge envvars create OAUTH_REDIRECT_URI     "https://<toolname>.toolforge.org/auth/callback"

# Flask
$ toolforge envvars create FLASK_SECRET_KEY "$(python3 -c 'import secrets; print(secrets.token_hex(32))')"
Create database
$ mariadb --defaults-file=$HOME/replica.my.cnf -h tools.db.svc.wikimedia.cloud
CREATE DATABASE s<NNNNN>__wikiface;
Build & deploy
# Build container image
$ toolforge build start https://github.com/DiFronzo/WikiVisage.git

# Setup the database
$ toolforge jobs run migrate --command "python migrate.py" --image tool-wikivisage/tool-wikivisage:latest --wait

# Start worker-1
$ toolforge jobs run ml-worker --command 'python -u worker.py --worker-id ml-worker-1' --image tool-wikivisage/tool-wikivisage:latest --continuous --mem 3Gi

# Start worker-2
$ toolforge jobs run ml-worker-2 --command 'python -u worker.py --worker-id ml-worker-2' --image tool-wikivisage/tool-wikivisage:latest --continuous --mem 3Gi

# Start web service
$ toolforge webservice buildservice start