Code Monkey home page Code Monkey logo

Comments (5)

lhoestq avatar lhoestq commented on May 18, 2024 1

There are indeed very few instances of raw image data in datasets - usually it's better to keep them as encoded in jpeg/png files to save disk space. The common way to have image/audio data is to simply have the path to the image/audio file

from dataset-viewer.

severo avatar severo commented on May 18, 2024

I agree: we can provide JPEG or PNG files from the endpoint, which are then linkable, cacheable, easier to manage on the frontend side. We will have to manage a special type for them: see #25 (maybe return both the raw values + the image URL)

re audio: from https://observablehq.com/@huggingface/types-of-the-datasets-columns, I understand that all the audio datasets have columns with a path to the audio file. Tensors are just used for images (Array2D for mnist: black and white, and Array3D for cifar: color)

from dataset-viewer.

severo avatar severo commented on May 18, 2024

After chatting with @lhoestq, I think that for all the types of images (see https://github.com/huggingface/moon-landing/pull/1040), I will provide the image inside the /rows endpoint response as:

image: {
  data: base64
  type: str (mimetype)
  filename: str (optional)
}

This would allow showing the images with https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs. And to allow downloading them as files with https://developer.mozilla.org/en-US/docs/Web/API/File/File.

This would help to avoid having to maintain a complex backend (have a cache of all the images, manage the uniqueness of the image URLs, have an internet-facing API, etc)

In some cases, the data will come directly from the datasets library, in other cases like mnist or cifar10, I will have to generate an image (one of https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types#image_types) then provide the bytes.

Same idea for the audio files.

Note: https://github.com/ahupp/python-magic might be used to detect the mimetype

from dataset-viewer.

severo avatar severo commented on May 18, 2024

Finally: I store the data in a file, then serve the file as a static file, and I give its URL in the data. For example, see:

from dataset-viewer.

severo avatar severo commented on May 18, 2024

The support for image datasets is now followed here: #63

For audio: #70

from dataset-viewer.

Related Issues (20)

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.