项目作者: cawfree

项目描述 :
✍️ Yann LeCun's MNIST handwritten digit dataset, made available to Node.js.
高级语言: JavaScript
项目地址: git://github.com/cawfree/mnist-dataset.git
创建时间: 2020-02-04T23:29:30Z
项目社区:https://github.com/cawfree/mnist-dataset

开源协议:MIT License

下载


mnist-dataset

✍️ Yann LeCun’s MNIST handwritten digit dataset, made available to Node.js. This library contains all of the utilities you need to download and parse the raw unfiltered dataset, which is expressed as JSON arrays. It uses fs to cache to your system’s tmpdir() so that you don’t have to keep downloading the dataset between successive executions of your software.


code style: prettier






🚀 Getting Started

Using npm:

  1. npm install --save mnist-dataset

Using yarn:

  1. yarn add mnist-dataset

✍️ Usage

  1. import { cache, trainingImagesUrl, trainingLabelsUrl } from 'mnist-dataset';
  2. (
  3. async () => {
  4. const trainingImages = await cache(trainingImagesUrl); // [[Number]] (i.e. [[0, 0, 0, ...], [0, 0, 0, ...], ...])
  5. const trainingLabels = await cache(trainingLabelsUrl); // [[Number]] (i.e. [[7], [2], ...])
  6. const toString = e =>
  7. [...Array(28)]
  8. .map((_, i) =>
  9. [...Array(28)].map((_, j) => (e[i * 28 + j] > 128 ? "#" : " ")).join("")
  10. )
  11. .join("\n");
  12. const [number7] = trainingImages;
  13. console.log(toString(number7));
  14. }
  15. )();

✌️ License

MIT



Buy @cawfree a coffee