question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Training with Raw Image data as inputs

See original GitHub issue

A GIF or MEME to give some spice of the internet

What is wrong?

Training error does not go below 1, and I think this is because my inputs strings have different lengths.

(currently i am using base64 encoded image data as input to the network, is this OK?)

Where does it happen?

In the a new brain.recurrent.RNN() when trying to run a net in node.js on my Windows 10

How do we replicate the issue?

Git Source here: https://github.com/mubaidr/image-parsing/blob/master/src/index.js#L45

How important is this (1-5)?

3

Expected behavior (i.e. solution)

Any suggestions to make input data to be same length for all images or maybe i am doing something wrong?

Other Comments

Thanks for the awesome work!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:22 (15 by maintainers)

github_iconTop GitHub Comments

14reactions
jusso-devcommented, Mar 28, 2018

I don’t have an answer to this but + 1 for the gif

2reactions
robertleeplummerjrcommented, Oct 7, 2018

Wouldn’t it be possbible to use r g b values from 0 to 1 in a neural network?

In gpu.js (which is the engine for brain.js v2) we’ve built it so you can feed images in directly: https://github.com/gpujs/gpu.js#supported-input-types

const myFunc = gpu.createKernel(function(image) {
    const pixel = image[this.thread.y][this.thread.x];
    this.color(pixel[0], pixel[1], pixel[2], pixel[3]);
})
  .setGraphical(true)
  .setOutput([100]);

const image = document.createElement('img');
image.src = 'my/image/source.png';
image.onload = () => {
  myFunc(image);
  // Result: colorful image
};

If we brought this functionality into v2 of brain.js, it would likely be:

  1. after the release of brain.js v2
  2. after the release of gpu.js v2 with OpenCL support

I’ve personally hoped for it for some time, and I think, although challenging, it would be terribly useful. However, we’d need to plan for how that api would look and ensure it’d be useful for real world scenarios.

However, @mubaidr raises a good point:

In my case images were simpler and color information was not needed.

Most scenarios really don’t need color data. But I figure, if you are going to make something useful…

Why not make it easy?

(Caution: possibly overly simplified use case)

net.run(<img />);

// <img /> = document.createElement('img');
Read more comments on GitHub >

github_iconTop Results From Across the Web

Use raw (image) data always better for training?
I was told that using raw data as input for deep learning is often or always (?) better than using pre-processed (or feature...
Read more >
From raw images to real-time predictions with Deep Learning
Deep learning models are trained by being fed with batches of data. Keras has a very useful class to automatically feed data from...
Read more >
Training & evaluating a classifier using raw image pixels
Training & evaluating a classifier using raw image pixels ... -Represent your data as features to serve as input to machine learning models....
Read more >
feeding raw data as image to deep learning machine and ...
The solution is to train two networks which play a game: The generator network G, which generates images. And the discriminator network D,...
Read more >
CSCI1290 Lab: RAW Images - Brown CS
Using the tool dcraw, extract the CFA image out of a RAW file. · Prepare the CFA image, including linearizing and normalizing the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found