Giter VIP home page Giter VIP logo

mnist's Introduction

mnist's People

Contributors

apelsyn avatar cazala avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mnist's Issues

mnist.js does not provide an export named 'default'

First, thank you for helping people load the MNIST data set!

Now onto replicating the problem, if you download your distribution to a hosted environment and link to mnist.js the following way: (I'm using NodeJS and a statically served folder with express.)

import mnist from './mnist.js';

you will get the following Syntax Error when the browser (Chrome in my case) tries to parse your code.

Uncaught SyntaxError: The requested module './mnist.js' does not provide an export named 'default'

I was able to get past this Syntax Error by adding "export default" to the first line of mnist.js:

export default (function e(t,n,r){function...

I hope this helps you make edits that will help others avoid this troubleshooting.

Add `.d.ts` TS ambient

It looks like this lib is practically in archive mode, so I figure I'll just post this ambient declaration here in a issue instead of a PR. Whoever wants to scratch the same itch like me, copy the following and paste into src/global.d.ts (filename actually doesn't matter, as long as it ends in .d.ts) in your project's directory.

declare module "mnist" {
  type Output = [number, number, number, number, number, number, number, number, number, number];

  type Datum = {
    input: number[];
    output: Output;
  };

  interface Digit {
    id: number;
    raw: number[];
    length: number;
    get: (index?: number) => number[];
    range: (start: number, end: number) => number[][];
    set: (start: number, end: number) => Datum[];
  }

  namespace MNIST {
    export function set(
      trainingSetSize: number,
      testSetSize: number
    ): {
      training: Datum[];
      test: Datum[];
    };

    export function get(count: number): Datum[];

    export function draw(
      digit: number[],
      context: CanvasRenderingContext2D,
      offsetX: number,
      offsetY: number
    ): void;

    export function toNumber(array: number[]): number;
  }

  export = MNIST as typeof MNIST & Digit[];
}

JavaScript heap out of memory

Hi,
I am trying to use your library in the browser and while building the project I get:

...
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
...
Aborted (core dumped)
npm ERR! code 134

I am using webpack for bundling and as I const mnist = require('mnist') I get the error.
I even tried loading dynamically with webpack:

  import(
    /* webpackChunkName: "mnist" */
    /* webpackMode: "lazy" */
    /* webpackPrefetch: false */
    /* webpackPreload: false */
    'mnist'
  ).then(mnist => {
    console.log('mnist');
  });

but this leads to the same error.

It would be nice if this package provides a way to load the dataset asynchronously in the browser.

Helpers seem to be shuffled.

Hi,

I'm trying to use your library but it seems that when I try to get a digit for 0, 2, 3, 4, 6, 7, 8, 9 I always get a wrong digit.
It seems that the mapping of real digits is wrong.

I always get this mapping:

desired digit real digit
0 8
1 1
2 4
3 6
4 6
5 5
6 9
7 3
8 7
9 0

Here the code that generates the following image:

  for (var i = 0; i < 10; i++) {
    var digit = mnist[i].get();

    var el: HTMLCanvasElement = <HTMLCanvasElement>document.getElementById('canvas' + i);

    var context = el.getContext('2d');

    context.fillStyle = 'white';
    context.fillRect(0, 0, el.width, el.height);

    console.info('Drawing...');
    mnist.draw(digit, context, 0, 0);

    // (<any>context).imageSmoothingEnabled = true;
    context.drawImage( el, 0, 0, 4*el.width, 4*el.height );
  } 

screen shot 2015-08-24 at 6 12 32 pm

Did I miss something ?

Btw, I am using JSPM with typescript.

Build: "Allocation failed - JavaScript heap out of memory"

I am using your library in my own application to feed a neural network. Thanks for your efforts!

It runs without any problems locally. But when I try to build my application with npm with mnist included, it fails to build the project.

Creating an optimized production build...

<--- Last few GCs --->

[77896:0x102801600]    76919 ms: Mark-sweep 1408.1 (1463.6) -> 1408.0 (1445.6) MB, 3084.7 / 0.0 ms  (+ 0.0 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 3085 ms) last resort
[77896:0x102801600]    79960 ms: Mark-sweep 1408.0 (1445.6) -> 1408.0 (1445.6) MB, 3040.6 / 0.0 ms  last resort


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x1e648c89cca1 <JSObject>
    2: token(aka token) [0x1e648c882241 <undefined>:1729] [bytecode=0x2efc0f2f56a1 offset=264](this=0x1e648c882241 <undefined>,type=0x2efc0f2eb451 <String[4]: punc>,value=0x1e648c8c1ed1 <String[1]: ,>,is_comment=0x1e648c882241 <undefined>)
    3: arguments adaptor frame: 2->3
    4: next(aka next) [0x1e648c882241 <undefined>:~2147] [pc=0x9b1f1e22da6](this=0x1e648c882241 <undefined>)
    5: expr_...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node::Abort() [/Users/mydspr/.nvm/versions/node/v8.3.0/bin/node]
 2: node::FatalException(v8::Isolate*, v8::Local<v8::Value>, v8::Local<v8::Message>) [/Users/mydspr/.nvm/versions/node/v8.3.0/bin/node]
 3: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/Users/mydspr/.nvm/versions/node/v8.3.0/bin/node]
...

These are my current node/npm versions:

→ node -v
v8.3.0
→ npm -v
5.6.0

Did you into this for your own application too?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.