{"id":27240626,"url":"https://github.com/davidmcneil/mnist","last_synced_at":"2026-03-05T08:31:02.785Z","repository":{"id":16006334,"uuid":"79120960","full_name":"davidMcneil/mnist","owner":"davidMcneil","description":"MNIST data set parser https://crates.io/crates/mnist","archived":false,"fork":false,"pushed_at":"2023-11-29T09:51:20.000Z","size":11578,"stargazers_count":19,"open_issues_count":4,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-08-09T01:38:13.836Z","etag":null,"topics":["image-recognition","machine-learning","mnist"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/davidMcneil.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":"2017-01-16T13:28:35.000Z","updated_at":"2024-05-21T16:28:45.000Z","dependencies_parsed_at":"2022-08-03T08:15:18.744Z","dependency_job_id":null,"html_url":"https://github.com/davidMcneil/mnist","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidMcneil%2Fmnist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidMcneil%2Fmnist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidMcneil%2Fmnist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidMcneil%2Fmnist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidMcneil","download_url":"https://codeload.github.com/davidMcneil/mnist/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248281376,"owners_count":21077423,"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","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":["image-recognition","machine-learning","mnist"],"created_at":"2025-04-10T19:19:35.186Z","updated_at":"2026-03-05T08:31:02.745Z","avatar_url":"https://github.com/davidMcneil.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MNIST\nA crate for parsing the [MNIST](http://yann.lecun.com/exdb/mnist/) and [Fashion MNIST](https://github.com/zalandoresearch/fashion-mnist) data set into vectors to be\nused by Rust programs.\n\n* [Crate](https://crates.io/crates/mnist)\n* [Documentation](https://docs.rs/mnist)\n\n## Example\n```rust\nuse mnist::*;\nuse ndarray::prelude::*;\n\nfn main() {\n\n    // Deconstruct the returned Mnist struct.\n    let Mnist {\n        trn_img,\n        trn_lbl,\n        tst_img,\n     tst_lbl,\n        ..\n    } = MnistBuilder::new()\n        .label_format_digit()\n        .training_set_length(50_000)\n        .validation_set_length(10_000)\n        .test_set_length(10_000)\n        .finalize();\n\n    let image_num = 0;\n    // Can use an Array2 or Array3 here (Array3 for visualization)\n    let train_data = Array3::from_shape_vec((50_000, 28, 28), trn_img)\n        .expect(\"Error converting images to Array3 struct\")\n        .map(|x| *x as f32 / 256.0);\n    println!(\"{:#.1?}\\n\",train_data.slice(s![image_num, .., ..]));\n\n    // Convert the returned Mnist struct to Array2 format\n    let train_labels: Array2\u003cf32\u003e = Array2::from_shape_vec((50_000, 1), trn_lbl)\n        .expect(\"Error converting training labels to Array2 struct\")\n        .map(|x| *x as f32);\n    println!(\"The first digit is a {:?}\",train_labels.slice(s![image_num, ..]) );\n\n    let _test_data = Array3::from_shape_vec((10_000, 28, 28), tst_img)\n        .expect(\"Error converting images to Array3 struct\")\n        .map(|x| *x as f32 / 256.);\n\n    let _test_labels: Array2\u003cf32\u003e = Array2::from_shape_vec((10_000, 1), tst_lbl)\n        .expect(\"Error converting testing labels to Array2 struct\")\n        .map(|x| *x as f32);\n}\n```\n\n## Fashion MNIST\nThe Fasion MNIST [dataset](https://github.com/zalandoresearch/fashion-mnist) offers a similarly-formatted \ndrop-in replacement dataset for the original MNIST set, but typically poses a more difficult classification challenge that handwritten numbers. \n\nAn example of downloading this dataset may be found by running: \n```sh\n$ cargo run --features download --example fashion_mnist\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidmcneil%2Fmnist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidmcneil%2Fmnist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidmcneil%2Fmnist/lists"}