r/TensorFlowJS • • Aug 06 '20

Released a library for creating tensors from CSV

5 Upvotes

https://github.com/isair/tensorflow-load-csv

Hi all,

I recently released a library for creating TensorFlow.js tensors directly from CSV files. Supports operations like standardisation so you can dive right into the fun parts of ML. It has 100% test coverage and supports TypeScript.

You can find the roadmaps for v1 and v2 in the GitHub page. All feedback is welcome!


r/TensorFlowJS • • Jun 24 '20

Tensorflowjs Posenet and React - Fun game

5 Upvotes

r/TensorFlowJS • • Jun 19 '20

6 Easy Steps to Implement a Computer Vision Application Using Tensorflow.js

5 Upvotes

r/TensorFlowJS • • Jun 14 '20

Facemesh AI + Eye tracking (details on comment)

Thumbnail
youtube.com
5 Upvotes

r/TensorFlowJS • • Mar 10 '20

Face and hand tracking in the browser with MediaPipe and TensorFlow.js

Thumbnail
blog.tensorflow.org
5 Upvotes

r/TensorFlowJS • • Feb 27 '20

TensorFlow.js for React Native: Up & Running! (starter template)

Thumbnail
tech.courses
5 Upvotes

r/TensorFlowJS • • Aug 15 '24

What are the biggest challenges you face as a web dev using TensorFlow JS?

4 Upvotes

Hi there!

What are the biggest challenges you face as a web dev using TensorFlow JS?

What would make your life easier?

I'm considering a coding project whose focus would be a library, dev tool or service that help web developers working on ML-related web applications. My research is starting to gather around TensorFlow JS, so I'm wondering what gaps there may be in the current tf.js ecosystem. What would truly move the needle for you in your workflow, that either doesn't exist yet, or does exist, but is spread across multiple separate solutions, etc?

Thanks!


r/TensorFlowJS • • May 07 '24

Error while Loading TensorFlow.js in React Native App

Post image
4 Upvotes

I'm trying to integrate the model.json to ReactNative app but the model is not loading if anyone know the solution please be kind to help...


r/TensorFlowJS • • Apr 19 '24

Meta's Llama3 8B model already ported to #WebAI ecosystem running entirely on device, client side, in the Web Browser with WebGPU. Capture on my NVIDIA 1070.

4 Upvotes

r/TensorFlowJS • • Mar 09 '24

MediaPipe Gemma 2.5 Billion parameter Web AI model used in browser beyond just a chat interface - fast too

Thumbnail
linkedin.com
4 Upvotes

r/TensorFlowJS • • Feb 25 '24

Gemma with TF JS?

4 Upvotes

Did anyone use Gemma with tfjs yet?
https://blog.google/technology/developers/gemma-open-models/

if yes, id be interested in your experience and how you implemented it (code snippet f.e.)


r/TensorFlowJS • • Nov 16 '22

Implement Image Classification in a JavaScript API

4 Upvotes

I want to create an API to analyze and classify fish species in my React application and know nothing of machine learning.

I was recommended to use TensorFlow.JS by my company senior.

So...

Any tools, course, tutorial, or more efficient way that you can recommend is more than appreciated.


r/TensorFlowJS • • Sep 17 '22

Trying to use tensorflow for very basic object recognition in my CCTV but its crashing

4 Upvotes

Hey Guys,

I hope someone can help me. Im a hobbyist programmer. I have a little experience with Javascript but none with Tensorflow or machine learning. I'm 49 and my brain struggles with that stuff!

The quick backstory is that I have a home CCTV that used to run from a server at home but in an effort to reduce electricity usage ive decided to stop using it. My cameras all have their own sd cards so I have configured them all to use those instead.

Sadly though, the built-in notifications are pretty rubbish. They don't have any kind of object detection and don't send a still image. I had the idea of renting a cheap cloud VPS and getting the cameras to FTP images. This works great and I made a nodejs script that watches the upload folder and telegrams me the pictures. I'm now trying to reduce the false-positives by adding in some object detection so it can delete pictures I don't need to see.

I followed a tutorial online (that I can't seem to find right now). I took the code from that and put it into my script and came up with the following. It actually does what I need but every so often it crashes. I suspect because of memory issues as its usually after its processed a number of images. I tried to make the code only process one image at a time but im wondering if i need to flush something or clear out some variables? I have no clue and this is a bit above my knowledge level!

It usually crashes every few hours but sometimes it can be quicker. If someone could tell me where the logs are store for tensorflow, I could post them here if it helps?

I also appreciate it could be that I'm asking too much of the VPS that i'm running.. The specs are

  • Intel(R) Xeon(R) CPU E5-2683 v3 @ 2.00GHz (1 core)

  • 1GB Ram

  • 40gb SSD

Any and all advice greatly appreciated.

// * TensorFlow Stuff
import * as tf from "@tensorflow/tfjs-node"
import coco_ssd from "@tensorflow-models/coco-ssd"

// Access the filesystem
import fs from 'fs'

// directory watcher
import chokidar from 'chokidar'

// for talking to telegram
import { Telegraf, Markup } from 'telegraf'

// dotenv config
import {} from 'dotenv/config'
import { CallTracker } from "assert"

// variable defaults
var TOKEN = ""
var CHAT_ID = ""
var WATCH_FOLDER = "/home/"

// check if variables saved to .env.  If so, use those instead.
if (process.env.TOKEN != undefined) TOKEN = process.env.TOKEN
if (process.env.CHAT_ID != undefined) CHAT_ID = process.env.CHAT_ID
if (process.env.WATCH_FOLDER != undefined) WATCH_FOLDER = process.env.WATCH_FOLDER

// Debug mode that sends output to console
var DEBUG = true

// Array of new files found that haven't been processed yet
var foundFileList = []

// Flag for if tensorflow is busy
var AI_Busy = false

// Array of objects we're interested in
const matchedTypes = ["cat","dog","person"]

// minimum certainty before an alert is sent
const certaintyThreshold = .60

// quick and dirty console logging
const log = (string) => {
  if (DEBUG) console.log(string)
  // TODO: Add logging to file
}

// * Init Tensor Flow Model
let model = undefined;
(async () => {
  model = await coco_ssd.load({
    base: "mobilenet_v1",
  })
})()

// initialise link to telegram bot
log("Opening link to Telegram bot")
const bot = new Telegraf(TOKEN)

// Inform user that CCTV has started or restarted
bot.telegram.sendMessage(CHAT_ID, "CCTV Uploader Has Started/Restarted")

// function to send the image via telegram and delete after upload
const telegramImage = async (file) => {
    // send image to telegram
    log("sending File to Telegram:" + file)
    await bot.telegram.sendPhoto(CHAT_ID, { source: file})
    // after upload delete the file
    log("Deleting File: " + file)
    await deleteFile(file) 
}

// function to delete a file
const deleteFile = (file) => {
  fs.unlink(file, (err) => {
      if (err) {
        console.error(err)
        return
      }
  })
}

// function to get just file extension
const get_file_extension = (filename) => {
  var a = filename.split(".")
  if( a.length === 1 || ( a[0] === "" && a.length === 2 ) ) {
    return ""
  }
  return a.pop().toLowerCase()
}

// function to go through any files not yet processed
const process_found_file_list = () => {
  // is the AI ready?, if no, don't go any further.
  if(!model) {
    log("AI not ready yet.")
    return
  }

  // check if there is anything left to process
  if (foundFileList.length > 0) {
  // yes! send the next file in the list
    processAI(foundFileList.shift())
  }
}


// check the image.  if object found, send via telegram.  if not, delete file.
const processAI = async(imageFileName) => {
  
  // check if we're already busy doing something.  If so, don't go any further
  if(AI_Busy) {
    log("AI is busy")
    return
  }

  // set flag that we're busy
  AI_Busy = true
  log("Processing "+imageFileName)

  // load in the image
  let img = fs.readFileSync(imageFileName)
  
  // decode into tensor file?
  const tens = tf.node.decodeImage(img)
  // run a detect and get results.
  const data = await model.detect(tens, 3, 0.25)
  
  // start with assuming nothing found in image
  let foundSomething = false

  // check if there were any records
  if (data.length > 0) {

    // iterate through each record
    for(let i = 0; i < count; i++) {
      
      // get current record
      let record = data[i]

      // get the 'class' from the record
      let recordClass = record['class']

      // check if the type matches the types we're looking for
      if(matchedTypes.find((str) => str === recordClass)) {
        log("Found a match, check certainty")

        // match found, what was the certainty score
        let score = parseFloat(record['score']).toFixed(2)
        log((score * 100)+"% certainty there is a "+recordClass+" in this picture")

        // if over our certainty threshold, we flag that something was definitely found
        if(score > certaintyThreshold ) {
          foundSomething = true
        } 
      } 
    }

    // so, was something found?
    if (foundSomething == true) {
      // yes! lets send that image to the user via telegram
      telegramImage(imageFileName)
    } else {
      // no! We can safely delete the image
      log("AI Didn't find anything interesting. deleting file")
      deleteFile(imageFileName)   
    }
  }

  // Now we're done, we can flag that we're ready for next file
  AI_Busy = false
}


// set up timed event to process outstanding files every 1500 milliseconds.
setInterval(process_found_file_list, 1500)

// initialise the watcher
log("Starting Watcher")
var watcher = chokidar.watch(WATCH_FOLDER, {ignored: /^\./, persistent: true, awaitWriteFinish: true})

// triggered when a new file is added
watcher.on('add', function(filenameWithPath) {
  // when a new image is added, upload it.  maybe add checking for .jpg later
  log("New file: " + filenameWithPath)

  var file_extension = get_file_extension(filenameWithPath)
  // is the file_extension jpg?  if so, we can proceed.
  if(file_extension == "jpg") {
      foundFileList.push(filenameWithPath)
    } else {
      // file isn't a jpg, delete it.
      log("File is not a jpg so deleting")
      deleteFile(filenameWithPath)
    }
  })

  .on('error', function(error) {console.error('Error happened', error)})

r/TensorFlowJS • • May 02 '22

TensorFlow.js Talks at Google IO

Thumbnail
io.google
4 Upvotes

r/TensorFlowJS • • Feb 05 '22

TensorFlow.js monthly newsletter via LinkedIn

Thumbnail
linkedin.com
4 Upvotes

r/TensorFlowJS • • Oct 13 '21

Data Science in JavaScript using Hal9 is now a thing!

Thumbnail
twitter.com
4 Upvotes

r/TensorFlowJS • • Sep 22 '21

TensorFlow.js Show & Tell #6 - October 1st, 9AM PT on TensorFlow YouTube Channel. From self driving cars to motion capture for VTubers, we got it all. Come join the fun. https://www.youtube.com/watch?v=S9OxBZKV45c

4 Upvotes

r/TensorFlowJS • • Jul 25 '21

Windows or Linux for NVidia-backed tensorflow.js?

4 Upvotes

I have a gaming laptop, few years old, has a NVidia GTX 1080 in it. If I'm currently interested only in browser-based tensorflow.js, in Chrome for example, would I get better performance in Windows with NVidia's installed drivers, or Ubuntu installing the proprietary NVidia drivers?


r/TensorFlowJS • • Jul 21 '21

Visualizing Autoencoders with Tensorflow.js

Thumbnail
douglasduhaime.com
4 Upvotes

r/TensorFlowJS • • Apr 19 '21

What is TensorFlow.js? A 1 pager for newbies.

Thumbnail
linkedin.com
4 Upvotes

r/TensorFlowJS • • Mar 05 '21

Code snippet for using Tensorflow.js toxicity detection to do AI

Thumbnail
playground.scaledynamics.com
4 Upvotes

r/TensorFlowJS • • Jan 02 '21

100.000’s of outputs turned into an image on gpu?

4 Upvotes

I’ve trained an image generator but to turn the prediction into an image I first need to get the result of the gpu.

Is there a way to turn the result into an image all on the gpu? For real time applications?


r/TensorFlowJS • • Dec 05 '20

4th TensorFlow.js Show & Tell livestream link now up! Goes live 9AM PT, Dec 11th

Thumbnail
youtube.com
4 Upvotes

r/TensorFlowJS • • Nov 27 '20

Text classification with TensorFlowJS

4 Upvotes

Hi All,

I'm looking at using TensorFlowJS and it would be good to know if what I want to do is achievable easily and if there are any resources out there which could help me. Also any suggestions to products which I could be looking at to achieve the same results would be useful to see if it's worth the dev effort. Basically APIs to integrate with our system, although cost is fairly important.

I'm pretty good with Node, Javascript etc but I'm no machine learning engineer.

So in simplest terms I want to classify conversations which my chatbot is having and flag if new conversations are matching these classifications.

Basically I want to be able to create classifiers from historical conversations as "bad", "positive", "looking for information", "not helping" etc and use this model to watch and alert on incoming conversations.

Thanks