Comments (12)
What I do is take an image every n frames, see if it is nsfw and if positive I keep it in a directory
from nsfw_model.
@xcbtrader Yeah, saving frames to disk and then calling the predict function is very time taking. I will ad a function to process a video directly. I will also add a paramter in that function so that you can select how many frames you want to analyze. eg: n=1 will analyze all frames and n=0.5 will analyze only half of randomly selected frames each second. Would this work for you?
from nsfw_model.
We have a ticket to do it in JavaScript that might be applied soon. But I'm actually not that great at Python. I imagine if you could grab all the keyframes down to a folder, then run all those images in the folder in a single batch, that would be pretty fast.
from nsfw_model.
@GantMan I think it'd be inaccurate by simply grabbing all keyframes, since keyframes can be defined by producer during transcoding. Therefore, it's possible that we get mislead by producer. On the other hand, given we have so many frames, in case of false positive, we will have a hard time to decide whether it's bad or not. I think we need a model dedicated for video handling
from nsfw_model.
@xcbtrader what if there are false positives?
from nsfw_model.
I keep them as well, and then I look at the directory to check what was analyzed.
In the tests I have done, I have found quite a few false positives.
This is the code to decide if is or not nsfw:
` result = detector.predict('temp.jpg')
datos = result['temp.jpg']
nsfw = False
if float(datos['porn']) > float(datos['drawings']) and float(datos['porn']) > float(datos['hentai']) and float(datos['porn']) > float(datos['neutral']) and float(datos['porn']) > float(datos['sexy']) and float(datos['porn']) > 0.93:
nsfw = True
else:
if float(datos['sexy']) > float(datos['drawings']) and float(datos['sexy']) > float(datos['hentai']) and float(datos['sexy']) > float(datos['neutral']) and float(datos['sexy']) > float(datos['porn']) and float(datos['sexy']) > 0.93:
nsfw = True
if nsfw:
name = './' 'nude_' + info_video[0] + '/' + info_video[0] + '_' + str(currentframe) + '.jpg'
print ('Creating...' + name + ' --- ' + str(float(datos['porn'])) + ';' + str(float(datos['sexy']))+ ';' + str(float(datos['neutral'])))
cv2.imwrite(name, frame)
frames_nude += 1
currentframe += 1`
from nsfw_model.
@xcbtrader based on your condition, you will have false negatives. Moreover, you will treat hentai as good content for work.
from nsfw_model.
Hentai doesn't worry me.
What conditions do you recommend?
from nsfw_model.
I do it differently.
I put a variable called n_frames that indicates how many frames it analyzes.
For example:
If n_frames = 10, it reads frame by frame, and every 10 frames it analyzes.
Analyze frame 10, 20, 30, 40 ....
from nsfw_model.
@xcbtrader I think you need to define a model to decide whether the video is nsfw based on discrete frame detection output. Moreover, your fixed frames can be cracked if someone intends.
from nsfw_model.
@xcbtrader Yeah, saving frames to disk and then calling the predict function is very time taking. I will ad a function to process a video directly. I will also add a paramter in that function so that you can select how many frames you want to analyze. eg: n=1 will analyze all frames and n=0.5 will analyze only half of randomly selected frames each second. Would this work for you?
Has this been implemented yet? I haven't found any reference to this function.
Right now I'm extracting frames from a video with ffmpeg, and sending them in batch to the predict method. I've found that doing this with up to 5 videos at once really kills the CPU. I'm using a 4 core CPU with 8 gigs of RAM. Any recommendation on the hardware requirements part for such a task for analyzing multiple videos at once
from nsfw_model.
Nothing in place yet. I'd love to see your solution.
This is something we might come back to as more advancements show up in TFJS
from nsfw_model.
Related Issues (20)
- Trying to cache the loaded model in Django
- False Positives HOT 1
- Model Weight License HOT 2
- Not trained on Dildos
- Input img/list
- How to inference use the. pb file of the inceptionv3 model?
- How i load this on Celery worker?
- How to disable spam? HOT 7
- Colab Script For Training
- Cannot download HOT 1
- Nude HOT 1
- Tflite - android studio
- 244 - 299 problem HOT 1
- cant run detection with nsfwjs
- Getting TypeError: Descriptors cannot not be created directly HOT 3
- Incorrect NSFW Classification for Civilization VI Leaders' Images
- ModuleNotFoundError: No module named 'tensorflow.python.training.tracking' HOT 1
- exit with code 4
- i can not pip install on mac m1 chip, with Python 3.9.18
- AttributeError: module 'tensorflow._api.v2.compat.v1' has no attribute 'estimator' HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nsfw_model.