{"id":16359369,"url":"https://github.com/gaborvecsei/barlow-twins","last_synced_at":"2026-02-14T11:36:10.458Z","repository":{"id":49110849,"uuid":"378203409","full_name":"gaborvecsei/Barlow-Twins","owner":"gaborvecsei","description":"Clean Tensorflow 2 Implementation of the Barlow Twins self-supervised learning method ","archived":false,"fork":false,"pushed_at":"2021-06-28T16:16:38.000Z","size":3576,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-21T17:12:04.623Z","etag":null,"topics":["embeddings","keras","python","self-supervised-learning","semi-supervised-learning","tensorflow","tensorflow2"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gaborvecsei.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-18T16:09:04.000Z","updated_at":"2023-01-21T19:17:52.000Z","dependencies_parsed_at":"2022-09-16T02:24:06.030Z","dependency_job_id":null,"html_url":"https://github.com/gaborvecsei/Barlow-Twins","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gaborvecsei/Barlow-Twins","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaborvecsei%2FBarlow-Twins","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaborvecsei%2FBarlow-Twins/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaborvecsei%2FBarlow-Twins/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaborvecsei%2FBarlow-Twins/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gaborvecsei","download_url":"https://codeload.github.com/gaborvecsei/Barlow-Twins/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaborvecsei%2FBarlow-Twins/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29443452,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T10:51:12.367Z","status":"ssl_error","status_checked_at":"2026-02-14T10:50:52.088Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["embeddings","keras","python","self-supervised-learning","semi-supervised-learning","tensorflow","tensorflow2"],"created_at":"2024-10-11T02:08:12.655Z","updated_at":"2026-02-14T11:36:10.441Z","avatar_url":"https://github.com/gaborvecsei.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Barlow Twins\n\nUnofficial Tensorflow 2 implementation of the [Barlow Twins Self-Supervised Learning method](https://arxiv.org/abs/2103.03230)\n\n```bash\n$ python train.py --name my_test /data\n$ python train.py --help\n```\n\n```python\nmodel = barlow_twins.BarlowTwinsModel(input_height=224,\n                                      input_width=224,\n                                      projection_units=8192,\n                                      drop_projection_layer=True)\nmodel.load_weights(saved_weights, by_name=True)\n# Input image values should be in range [0, 255] --\u003e preprocessing is built into the model\nembedding = model(image)\n```\n\n# Results\n\n**Convergence (Oxford 102 Flowers**\n\n\u003cimg src=\"art/oxford_flowers_adam_sgd.png\" width=\"600\" alt=\"training_losses\"\u003e\u003c/a\u003e\n\n# Setup\n\n## Pip/Conda\n\n```bash\npip install -r requirements.txt\n```\n\n## Docker\n\n**Build**\n\n```bash\ndocker build -t barlow .\n```\n\n**Run a training**\n\n```bash\ndocker run --rm \\\n           -t \\\n           -u $(id -u):$(id -g) \\\n           --gpus all \\\n           -v $(pwd):/code \\\n           -v \u003cDATASET_FOLDER_PATH\u003e:/data \\\n           -w /code \\\n           barlow \\\n           python train.py --name my_test /data\n```\n\n# Citations\n\n```bibtex\n@article{DBLP:journals/corr/abs-2103-03230,\n    author    = {Jure Zbontar and Li Jing and Ishan Misra and Yann LeCun and St{\\'{e}}phane Deny},\n    title     = {Barlow Twins: Self-Supervised Learning via Redundancy Reduction},\n    journal   = {CoRR},\n    volume    = {abs/2103.03230},\n    year      = {2021},\n    url       = {https://arxiv.org/abs/2103.03230},\n    archivePrefix = {arXiv},\n    eprint    = {2103.03230},\n    timestamp = {Mon, 15 Mar 2021 17:30:55 +0100},\n    biburl    = {https://dblp.org/rec/journals/corr/abs-2103-03230.bib},\n    bibsource = {dblp computer science bibliography, https://dblp.org}\n}\n```\n\n# TODOs\n\n- Evaluation\n    - Linear evaluation\n    - KNN eval\n- Choose or use custom backbone\n- Save model\n    - Save only when loss improved\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgaborvecsei%2Fbarlow-twins","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgaborvecsei%2Fbarlow-twins","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgaborvecsei%2Fbarlow-twins/lists"}