We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I see https://tfhub.dev/tensorflow/lite-model/inception_v4/1/default/1
Is that best one?
or this one best? https://tfhub.dev/google/imagenet/inception_v3/classification/5
I need a local app to classify all images
Here my code
const fs = require('fs'); const tf = require('@tensorflow/tfjs-node'); const nsfwjs = require('nsfwjs'); async function classifyImageWithInceptionV3(imagePath) { const imageBuffer = fs.readFileSync(imagePath); const image = tf.node.decodeImage(imageBuffer); // Load InceptionV3 model from TensorFlow.js const inceptionV3 = await tf.loadLayersModel('https://tfhub.dev/google/imagenet/inception_v3/classification/5'); const processedImage = tf.image.resizeBilinear(image, [299, 299]).toFloat().div(255.0).expandDims(); const predictions = await inceptionV3.predict(processedImage).data(); return predictions; } function moveImage(imagePath, category) { const destinationFolder = `./${category}`; fs.renameSync(imagePath, `${destinationFolder}/${imagePath}`); } async function scanImages(inputFolder) { const imageFiles = fs.readdirSync(inputFolder); for (const imageFile of imageFiles) { const imagePath = `${inputFolder}/${imageFile}`; const predictions = await classifyImageWithInceptionV3(imagePath); const maxProbability = Math.max(...predictions); const maxIndex = predictions.indexOf(maxProbability); // Move to the folder with the highest probability const categories = ['Drawing', 'Hentai', 'Porn', 'Sexy']; moveImage(imagePath, categories[maxIndex]); } } const inputFolder = './input'; // Replace with your input folder path scanImages(inputFolder);
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I see https://tfhub.dev/tensorflow/lite-model/inception_v4/1/default/1
Is that best one?
or this one best? https://tfhub.dev/google/imagenet/inception_v3/classification/5
I need a local app to classify all images
Here my code
The text was updated successfully, but these errors were encountered: