{"id":51261616,"url":"https://github.com/europanite/image_ai_offline_distillation","last_synced_at":"2026-06-29T12:32:11.733Z","repository":{"id":357123833,"uuid":"1235475866","full_name":"europanite/image_ai_offline_distillation","owner":"europanite","description":"image_ai_offline_distillation","archived":false,"fork":false,"pushed_at":"2026-05-11T13:24:57.000Z","size":255,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-11T13:34:37.739Z","etag":null,"topics":["distillation","distillation-loss","distillation-model","expo","image","image-ai","image-processing","jest","lightweight","pytest","python","typescript"],"latest_commit_sha":null,"homepage":"https://europanite.github.io/image_ai_offline_distillation/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/europanite.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-11T11:10:00.000Z","updated_at":"2026-05-11T13:27:55.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/europanite/image_ai_offline_distillation","commit_stats":null,"previous_names":["europanite/image_ai_offline_distillation"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/europanite/image_ai_offline_distillation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/europanite%2Fimage_ai_offline_distillation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/europanite%2Fimage_ai_offline_distillation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/europanite%2Fimage_ai_offline_distillation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/europanite%2Fimage_ai_offline_distillation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/europanite","download_url":"https://codeload.github.com/europanite/image_ai_offline_distillation/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/europanite%2Fimage_ai_offline_distillation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34927675,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-29T02:00:05.398Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["distillation","distillation-loss","distillation-model","expo","image","image-ai","image-processing","jest","lightweight","pytest","python","typescript"],"created_at":"2026-06-29T12:32:10.447Z","updated_at":"2026-06-29T12:32:11.724Z","avatar_url":"https://github.com/europanite.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\nlayout: page\ntitle: \"🇺🇸 English\"\npermalink: /\nlang: en\n---\n\n# [Image Offline Distillation](https://github.com/europanite/image_ai_offline_distillation \"Image Offline Distillation\")\n\n[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n![OS](https://img.shields.io/badge/OS-Linux%20%7C%20macOS%20%7C%20Windows-blue)\n[![Python](https://img.shields.io/badge/python-3.10%20|%203.11|%203.12|%203.13-blue)](https://www.python.org/)\n\n[![CodeQL Advanced](https://github.com/europanite/image_ai_offline_distillation/actions/workflows/codeql.yml/badge.svg)](https://github.com/europanite/image_ai_offline_distillation/actions/workflows/codeql.yml)\n[![Python Lint](https://github.com/europanite/image_ai_offline_distillation/actions/workflows/lint.yml/badge.svg)](https://github.com/europanite/image_ai_offline_distillation/actions/workflows/lint.yml)\n[![CI](https://github.com/europanite/image_ai_offline_distillation/actions/workflows/ci.yml/badge.svg)](https://github.com/europanite/image_ai_offline_distillation/actions/workflows/ci.yml)\n[![Pytest](https://github.com/europanite/image_ai_offline_distillation/actions/workflows/pytest.yml/badge.svg)](https://github.com/europanite/image_ai_offline_distillation/actions/workflows/pytest.yml)\n\n![Python](https://img.shields.io/badge/python-3670A0?style=for-the-badge\u0026logo=python\u0026logoColor=ffdd54)\n![Pytest](https://img.shields.io/badge/pytest-%23ffffff.svg?style=for-the-badge\u0026logo=pytest\u0026logoColor=2f9fe3)\n![FastAPI](https://img.shields.io/badge/FastAPI-005571?style=for-the-badge\u0026logo=fastapi)\n![React Native](https://img.shields.io/badge/react_native-%2320232a.svg?style=for-the-badge\u0026logo=react\u0026logoColor=%2361DAFB)\n![TypeScript](https://img.shields.io/badge/typescript-%23007ACC.svg?style=for-the-badge\u0026logo=typescript\u0026logoColor=white)\n![Jest](https://img.shields.io/badge/-jest-%23C21325?style=for-the-badge\u0026logo=jest\u0026logoColor=white)\n![Expo](https://img.shields.io/badge/expo-1C1E24?style=for-the-badge\u0026logo=expo\u0026logoColor=#D04A37)\n\n\u003cp align=\"right\"\u003e\n  \u003ca href=\"https://europanite.github.io/image_ai_offline_distillation/\"\u003e🇺🇸 English\u003c/a\u003e |\n  \u003ca href=\"https://europanite.github.io/image_ai_offline_distillation/hi/\"\u003e🇮🇳 हिंदी\u003c/a\u003e |\n  \u003ca href=\"https://europanite.github.io/image_ai_offline_distillation/ja/\"\u003e🇯🇵 日本語\u003c/a\u003e |\n  \u003ca href=\"https://europanite.github.io/image_ai_offline_distillation/zh-CN/\"\u003e🇨🇳 简体中文\u003c/a\u003e |\n  \u003ca href=\"https://europanite.github.io/image_ai_offline_distillation/es/\"\u003e🇪🇸 Español\u003c/a\u003e |\n  \u003ca href=\"https://europanite.github.io/image_ai_offline_distillation/pt-BR/\"\u003e🇧🇷 Português (Brasil)\u003c/a\u003e |\n  \u003ca href=\"https://europanite.github.io/image_ai_offline_distillation/ko/\"\u003e🇰🇷 한국어\u003c/a\u003e |\n  \u003ca href=\"https://europanite.github.io/image_ai_offline_distillation/de/\"\u003e🇩🇪 Deutsch\u003c/a\u003e |\n  \u003ca href=\"https://europanite.github.io/image_ai_offline_distillation/fr/\"\u003e🇫🇷 Français\u003c/a\u003e\n\u003c/p\u003e\n\n![\"image\"](./assets/images/web_ui.png)\n\nA small container for **offline knowledge distillation**.\n\nThe project keeps a simple full-stack shape:\n\n- **Backend**: FastAPI + PyTorch + torchvision\n- **Frontend**: Expo / React Native Web\n- **Container**: Docker Compose\n\n```text\npublic ImageNet teacher model\n  -\u003e run once on images\n  -\u003e save teacher logits\n  -\u003e train a small CNN student from cached logits\n  -\u003e compare teacher/student agreement\n```\n\nThe default teacher is `torchvision.models.resnet18` with public ImageNet weights. You can also use `resnet50` or `mobilenet_v3_large`.\n\nThe student is a tiny CNN that outputs the same 1000 ImageNet logits. It is trained to imitate the teacher's softened probability distribution.\n\n## Why this is offline distillation\n\nThe key artifact is:\n\n```text\nartifacts/teacher_logits_train.pt\n```\n\nAfter this file is created, the student can be trained without calling the teacher model again.\n\n## Dataset modes\n\n| Dataset | Purpose |\n| --- | --- |\n| `cifar10` | Downloads CIFAR-10 and resizes it to ImageNet input size. |\n| `image_folder` | Uses your own unlabeled images under `data/images`. |\n\nFor a real experiment, put images here:\n\n```text\ndata/images/\n```\n\nNested folders are allowed. Labels are not required.\n\n## Start\n\n```bash\ndocker compose up --build\n```\n\n\n\u003e The frontend service uses Expo Web with Docker `network_mode: host` so that `expo start --web --localhost --port 8081` is reachable from the host browser. This is intended for Linux Docker environments.\n\nOpen:\n\n```text\nFrontend: http://localhost:8081\nBackend:  http://localhost:8000/docs\n```\n\n## Run from API\n\n```bash\ncurl -X POST http://localhost:8000/api/v1/distillation/run-all \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n    \"teacher\": \"resnet18\",\n    \"dataset\": \"fake\",\n    \"samples\": 128,\n    \"batch_size\": 16,\n    \"epochs\": 2,\n    \"learning_rate\": 0.001,\n    \"temperature\": 3.0,\n    \"device\": \"cpu\"\n  }'\n```\n\n## Run from CLI\n\n```bash\ndocker compose run --rm backend python /app/cli.py run-all \\\n  --teacher resnet18 \\\n  --dataset fake \\\n  --samples 128 \\\n  --batch-size 16 \\\n  --epochs 2 \\\n  --temperature 3.0 \\\n  --device cpu\n```\n\nFor your own image folder:\n\n```bash\ndocker compose run --rm backend python /app/cli.py run-all \\\n  --teacher resnet18 \\\n  --dataset image_folder \\\n  --samples 256 \\\n  --epochs 3 \\\n  --device cpu\n```\n\n## Outputs\n\n```text\nartifacts/\n├── teacher_logits_train.pt\n├── teacher_cache_metadata.json\n├── student_model.pt\n└── report.json\n```\n\n`report.json` includes:\n\n- `teacher_student_top1_agreement`\n- `distillation_kl`\n- `student_parameters`\n- training loss history\n\n## Tests\n\n```bash\ndocker compose -f docker-compose.test.yml run --rm backend_test\ndocker compose -f docker-compose.yml -f docker-compose.test.yml run --rm frontend_test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feuropanite%2Fimage_ai_offline_distillation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feuropanite%2Fimage_ai_offline_distillation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feuropanite%2Fimage_ai_offline_distillation/lists"}