Coder Social home page Coder Social logo

Comments (4)

swimauger avatar swimauger commented on September 15, 2024

I mean... It is possible, but it's not elegant (going from JavaScript to SQL so rarely is). With the current version (v1.0.8) you can access the knnClassifier dataset. From there you can use Tensorset to make it readable for ImageClassifier

This will give you the dataset data as JSON without having to save it

const knnDataset = JSON.parse(await Tensorset.stringify(myImageClassifier.classifier.getClassifierDataset())); // Though classifier will most likely not be exposed like this in future updates

knnDataset will look something like this:

[
    {
        "label": "Example 1 Label",
        "values": [ 52, 432, 432, 12, 152, ... ],
        "shape": [ 20, 1024 ]
    },
    {
        "label": "Example 2 Label",
        "values": [ 52, 432, 432, 12, 152, ... ],
        "shape": [ 30, 1024 ]
    },
    ...
]

From there you can make your SQL statement to save the data to your database.

When your ready to read it back in put it in the exact same format as the knnDataset variable above and set the classifier like so:

myImageClassifier.classifier.setClassifierDataset(Tensorset.parse(/* The similar variable to knnDataset */));

from image-classifier.

swimauger avatar swimauger commented on September 15, 2024

Hope this helped, but I do not plan on making any future updates to support this. My best recommendation would be use a NoSQL database like Firebase or Mongo if possible. I'm closing the issue, but feel free to leave a comment here if you have any more questions about this.

from image-classifier.

TrashUwU avatar TrashUwU commented on September 15, 2024

Thanks! The only problem with JSON is it can't handle large data and breaks.

from image-classifier.

swimauger avatar swimauger commented on September 15, 2024

Np, but if you're referring to the speed at which the dataset is being loaded or unloaded, ImageClassifier hasn't yet been updated to use the latest version of Tensorset, which drastically improves the speed.

All this being said if large amounts of data is an issue, I've been thinking of creating a new format for compressed and diversified datasets, so the performance could improve.

from image-classifier.

Related Issues (9)

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.