{"id":23029511,"url":"https://github.com/giochem/mlp-mixer-pytorch","last_synced_at":"2026-05-03T06:34:16.814Z","repository":{"id":246643478,"uuid":"821736936","full_name":"giochem/mlp-mixer-pytorch","owner":"giochem","description":"Implementation for paper MLP-Mixer","archived":false,"fork":false,"pushed_at":"2024-06-30T03:21:23.000Z","size":246,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-02T20:31:49.658Z","etag":null,"topics":["classification","mlp-mixer","pytorch"],"latest_commit_sha":null,"homepage":"https://arxiv.org/pdf/2105.01601","language":"Python","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/giochem.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-29T09:41:10.000Z","updated_at":"2024-11-17T07:49:33.000Z","dependencies_parsed_at":"2024-06-29T10:47:53.342Z","dependency_job_id":"89840a9b-c619-478d-80f7-56928f3162e7","html_url":"https://github.com/giochem/mlp-mixer-pytorch","commit_stats":null,"previous_names":["giochem/mlp-mixer-pytorch"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/giochem/mlp-mixer-pytorch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giochem%2Fmlp-mixer-pytorch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giochem%2Fmlp-mixer-pytorch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giochem%2Fmlp-mixer-pytorch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giochem%2Fmlp-mixer-pytorch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/giochem","download_url":"https://codeload.github.com/giochem/mlp-mixer-pytorch/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giochem%2Fmlp-mixer-pytorch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32560596,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T03:21:47.309Z","status":"ssl_error","status_checked_at":"2026-05-03T03:21:43.884Z","response_time":103,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["classification","mlp-mixer","pytorch"],"created_at":"2024-12-15T14:15:41.112Z","updated_at":"2026-05-03T06:34:16.799Z","avatar_url":"https://github.com/giochem.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [PYTORCH] MLP-Mixer: An all-MLP Architecture for Vision\n\n## Introduction\n\nImplementation for paper [MLP-Mixer: An all-MLP Architecture for Vision](https://arxiv.org/pdf/2105.01601.pdf). Give me a star if you like this repo.\n\nAuthor:\n\n- Github: giochem\n\n- Email: tranxuantruong203hn@gmail.com\n\n![image](./image/mlp-mixer.png)\n[Note] You can use your data to train this model.\n## I. Set up environment\n\n1. Make sure you have installed pytorch and related libraries.\n\n## II. Set up your dataset.\n\nCreate 2 folders `train` and `valid` in the `data` folder (which was created already). Then `Please copy` your images with the corresponding names into these folders.\n\n- `train` folder was used for the training process\n- `valid` folder was used for validating training result after each epoch\n\nThis library use `torchvision.datasets.ImageFolder` API from `Pytorch` to load images. Make sure you have some understanding of how it works via [its document](https://pytorch.org/vision/0.16/generated/torchvision.datasets.ImageFolder.html).\n\nStructure of these folders.\n\n```\ntrain/\n...class_a/\n......a_image_1.jpg\n......a_image_2.jpg\n...class_b/\n......b_image_1.jpg\n......b_image_2.jpg\n...class_c/\n......c_image_1.jpg\n......c_image_2.jpg\n```\n\n```\nvalid/\n...class_a/\n......a_image_1.jpg\n......a_image_2.jpg\n...class_b/\n......b_image_1.jpg\n......b_image_2.jpg\n...class_c/\n......c_image_1.jpg\n......c_image_2.jpg\n```\n\n## III. Train your model by running this command line\n\n```bash\npython train.py --epochs ${epochs} --num-classes ${num_classes}\n```\n\nYou want to train a model in 10 epochs for binary classification problems (with 2 classes)\n\nExample:\n\n```bash\npython train.py --epochs 10 --num-classes 2\n```\n\nYou can train CIFAR10 dataset without put data to folders\n\n```bash\npython train.py --dataset CIFAR10 --epochs 10 --num-classes 10 --image-size 32 --patch-size 4 --batch-size 4 --tokens-mlp-dim  1024 --channels-mlp-dim 128 --hidden-dim 256 --num-of-mlp-blocks 2\n```\n\nThere are some `important` arguments for the script you should consider when running it:\n\n- `dataset`: Get training on CIFAR10 dataset or your dataset\n- `train-folder`: The folder of training images\n- `valid-folder`: The folder of validation images\n- `num-classes`: The number of your problem classes.\n- `batch-size`: The batch size of the dataset\n- `patch-size`: The patch size of the model (Patch resolution P x P)\n- `hidden-dim`: Patch Projection Dimension (Hidden size C)\n- `tokens-mlp-dim`: Token-mixing units (MLP dimension Ds).\n- `channels-mlp-dim`: Channel-mixing units (MLP dimension Dc).\n- `num-of-mlp-blocks`: The number of MLP Blocks (Number of layer)\n- `log-path`: Where the model when training writed (loss, acc) and after training saved\n- `model-folder`: Where the model after training saved\n\nAfter training successfully, your model will be saved to `model-folder` defined before\n\nSome import params you should follow:\n\n![image](./image/params.png)\n\n## IV. Testing model with a new image\n\nWe offer a script for testing a model using a new image via a command line:\n\n```bash\npython predict.py --test-file-path ${test_file_path}\n```\n\nwhere `test_file_path` is the path of your test image.\n\nExample:\n\n```bash\npython predict.py --test-file-path ./data/test/cat.2000.jpg\n```\n\n## IV. Contribute\n\nIf you meet any issues when using this library, please let me know via the issues submission tab.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgiochem%2Fmlp-mixer-pytorch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgiochem%2Fmlp-mixer-pytorch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgiochem%2Fmlp-mixer-pytorch/lists"}