{"id":32976570,"url":"https://github.com/facebookresearch/noise-as-targets","last_synced_at":"2025-11-16T08:01:54.412Z","repository":{"id":66082702,"uuid":"99703433","full_name":"facebookresearch/noise-as-targets","owner":"facebookresearch","description":"Unsupervised Learning by Predicting Noise","archived":true,"fork":false,"pushed_at":"2021-10-12T21:32:41.000Z","size":26,"stargazers_count":90,"open_issues_count":0,"forks_count":11,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-02-23T00:14:53.199Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/facebookresearch.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":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-08-08T14:43:12.000Z","updated_at":"2024-03-25T11:37:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"1f193fab-e3a7-43e4-8386-9e3eebcf5683","html_url":"https://github.com/facebookresearch/noise-as-targets","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/facebookresearch/noise-as-targets","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebookresearch%2Fnoise-as-targets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebookresearch%2Fnoise-as-targets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebookresearch%2Fnoise-as-targets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebookresearch%2Fnoise-as-targets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/facebookresearch","download_url":"https://codeload.github.com/facebookresearch/noise-as-targets/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebookresearch%2Fnoise-as-targets/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284678558,"owners_count":27045646,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-16T02:00:05.974Z","response_time":65,"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":[],"created_at":"2025-11-13T06:00:31.219Z","updated_at":"2025-11-16T08:01:54.399Z","avatar_url":"https://github.com/facebookresearch.png","language":"Lua","funding_links":[],"categories":["Computer Vision"],"sub_categories":["Image Representation Learning"],"readme":"# Unsupervised Learning by Predicting Noise\n\nThis is the code used for unsupervised training of convolutional neural networks as described in the ICML 2017 paper Unsupervised Learning by Predicting Noise ([arXiv](https://arxiv.org/abs/1704.05310)).\n\nThe code is composed of two modules, one for unsupervised feature learning, and one for training a supervised classifier on top of them.\n\n## Requirements\n\nThe code is in Lua Torch, and therefore requires a working torch installation.\nIt was tested with a LuaJIT installation obtained using:\n```\ngit clone https://github.com/torch/luajit-rocks.git\ncd luajit-rocks\nmkdir build\ncd build\ncmake .. -DCMAKE_INSTALL_PREFIX=/your/prefix\n```\nwhere `/your/prefix` is the path where you want a local install of LuaJIT and all dependencies.\nIn order to run this code, you will need the following modules:\n```\ntorch\ncutorch\nnn\ncunn\ncudnn\ntorchnet\nimage\n```\nYou can install them using:\n```\n$ /your/prefix/bin/luarocks install [package]\n```\n\n## Compiling the C code\n\nComputing the optimal permutation of targets requires solving an assignment problem.\nWe do so using the Hungarian algorithm, also known as the Kuhn-Munkres algorithm.\nWe provide a C implementation and the corresponding Lua interface (using ffi).\nIn order to use it, please run `$ make` which will compile the C code and create the shared library.\n\n## Getting data\n\nThis code uses an `IndexedDataset` to load data.\nThis is a TorchNet data structure which provides an efficient way to bundle data into a single archive file, associated with an indexed file.\nGiven a copy of ImageNet, you can create the archive using:\n```\n$ ./make-index.sh\n```\nInside this script, please replace the source and destination paths as follows:\n```\nIMAGENET=/data/users/bojanowski/data/imagenet-full-size\nDEST=/data/users/bojanowski/data/imagenet-idx\n```\nWhere `/data/users/bojanowski/data/imagenet-full-size` is where you store your copy of ImageNet images:\n```\n$ ls -1 /data/users/bojanowski/data/imagenet-full-size\nlabels.txt\nsynset_words.txt\ntest\ntrain\nval\n```\nThis will produce indexed archives (roughly 70Gb for training images) in the `${DEST}` folder.\n\n## Running the unsupervised training\n\nUnsupervised training can be launched by running:\n```\n$ ./main.sh\n```\nPlease specify the location of your LuaJIT installation in the script:\n```\nLUAJIT=/data/users/bojanowski/local/bin/luajit\n```\nPlease also provide the path to the data folder where the `imagenet-idx` folder is located:\n```\nDATA=/data/users/bojanowski/data\n```\nFinally, you can specify where you want to save the logs, checkpoints and models using:\n```\nEXP=exp\n```\nDuring training, checkpoints and logs will be saved to the directory specified in `${EXP}`.\nA new directory is created for each new set of parameters.\nThis directory of results contains the following things:\n```\n$ ls -1 exp/unsup-dim-2048-perm-3-lr-1.0e-02\ncheckpoint.bin\ncheckpointModel.bin\nconfig.bin\nlog-20170727-022756.txt\nrcp-0-checkpoint.bin\nrcp-0-checkpointModel.bin\nrcp-1-checkpoint.bin\nrcp-1-checkpointModel.bin\nrcp-2-checkpoint.bin\nrcp-2-checkpointModel.bin\nepoch-00010\nepoch-00020\n```\nWe have implemented rolling checkpoints, where a version of the model and the corresponding codes are saved every epoch, in a rolling fashion.\nThe files `checkpoint.bin` and `checkpointModel.bin` are symbolic links to the latest checkpoint available.\nModels are also saved every other k epochs (set using the `-saveperiod` flag), and can be found in for instance in `epoch-00010'.\n\nA complete list of options can be obtained using:\n```\n$ luajit main.lua -h\n```\n\n## Learning the MLP on the supervised task\n\nOnce the unsupervised training is finished, you can launch the transfer task using:\n```\n$ ./test.sh\n```\nYou need to specify the path to the ImageNet data and the directory in which your model lies.\nThe code should run the supervised training of the MLP in the AlexNet and log the train and val performance along epochs.\nThe output of this code will be saved in a subdirectory of where the model is.\n\nThe full set of parameters for this supervised training can be obtained using:\n```\n$ luajit test.lua -h\n```\n\n## ImageNet classification with a pre-trained model\n\nWe provide a pre-trained model, available for download [here](https://dl.fbaipublicfiles.com/noise-as-targets/model.bin).\nYou can run the transfer task with a pre-trained model by running:\n```\n$ ./test-pretrained.sh\n```\nThis will download the pre-trained model and launch the transfer learning on ImageNet.\n\n## License\n\nThis code is licensed under CC-BY-NC license. See the LICENSE file for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffacebookresearch%2Fnoise-as-targets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffacebookresearch%2Fnoise-as-targets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffacebookresearch%2Fnoise-as-targets/lists"}