
Chrome, Firefox extension that blocks NSFW images using TensorFlow JS - bishalb
https://github.com/nsfw-filter/nsfw-filter
======
liability
> _All the images remain hidden until they are found to be NSFW or not_

The demo screenshot/page seems to only show NSFW images, so the demo doesn't
convey how quickly this classifier can operate. The demo page should have some
non-NSFW images to show off how quickly SFW images are revealed, since the
default is to block all images.

~~~
navendu_p
We will change that. Seems like a good idea

------
refresher
I’ve jokingly / seriously been waiting for things like this. I’m the type to
go overboard with filtering and mute lists on twitter, but images are harder
to deal with. I did have a 60,000 line pastebin that was used in conjunction
with a Chrome extension to block Wojack and Pepe memes on 4chan using md5
hashes, but something not rely on specific hashes is obviously superior.

One day someone will release the ‘detect and block anything resembling kpop’
extension for Twitter and I’ll be happy.

~~~
justanotherhn
I expressed some interest at some point of hiding profiles which contained a
certain phrase in their bio and got downvoted. Does anyone know of any
extentions that can do this?

~~~
sergiotapia
I would use this for sure. Certain phrases are great flags for me to know "I
won't be interested in anything this person has to say."

~~~
SV_BubbleTime
Do you think the issue with hyperpartisanism is that people’s existing bubbles
and filters just aren’t strong enough?

~~~
sergiotapia
I don't know about all of that, but I do know I want to use twitter for tech
and not politics.

------
m3kw9
From experience 99.9% of the time unless I visit a porn site purposely or some
warez site by accident, or questionable reddit channels, I see no NSFW.
However I do see some benefits if this was for kids.

~~~
yonixw
Sound like you have ad-block or avoid sketchy (pirate) websites.

~~~
esperent
Adblock is a far simpler and probably more effective solution than this, with
a host of other benefits such as speeding up websites, whereass presumably
this extension will slow down the browsing experience quite a bit. Given that,
the only reason I can see for using this is if adblock was not doing a good
enough job alone.

------
ndm000
Shameless plug - I've been working on something similiar, but with a different
aim.

[https://github.com/nmurray1984/porn-blocker-chrome-
extension](https://github.com/nmurray1984/porn-blocker-chrome-extension)

I found that the hardest problem to solve was the prevanlence of false
positives. Even if you have a low false positive rate, it's still very likely
to have an image blocked regularly just due to volume.

For that reason, the focus of my plugin is - for users that are OK with it -
contributing URLs that are not NSFW but have been blocked. The extension
includes a right-click menu option to do so.

~~~
antpls
Assuming you meant some SFW images are mistakenly blocked, it is an easier
situation than with true negative.

Once an image tested positive with your first model, you could run a second
more CPU intensive model (but also more accurate) on it.

~~~
wongarsu
Assuming you have a notably more accurate algorithm. It's a difficult problem
even with infinite computing power.

------
kmfrk
This is great, except it'd be really, really great with some sort of
placeholder image for the blocked images if possible.

~~~
navendu_p
We had that in the first version but we kind of removed it. We will try to add
one option for that.

------
solarkraft
Why would I care about not seeing NSFW images?

What I really _do_ care about is not seeing worthless clickbait. That makes me
endlessly angry. Could you build a filter like that on top of this?

~~~
cheeze
Uh, because I'm at work and wouldn't mind an additional layer of protection.

Because I live stream and people try to trick me into viewing NSFW content on
stream.

Is this really a question?

------
andrekorol
This extension reminded me of that Black Mirror episode where a mother
filtered what her daughter could see and hear.

Great work with TensorFlow by the way, can't wait to see this technology
maturing over the years.

------
zxcvbn4038
Missed opportunity - where is the browser extension that makes all of the
images NSFW?

You leave your laptop unlocked and suddenly it looks like the nude bomb went
off
([https://m.imdb.com/title/tt0081249/](https://m.imdb.com/title/tt0081249/)).

------
gftsantana
I've been wanting for something like this ever since we by accident looked at
our 9 year old daughter's screen. She likes to draw characters from her
favorite cartoon and searches for images on the web. Apparently there's a porn
actress with the same name as one of the characters... DDG was set to
"strict", so no full nudity or any explicit act, but still _very_ NSFW.

~~~
moooo99
DDG is kind of fascinating. Ever since I switched to DDG as my main search
engine, I feel like the internet is 90% porn. Although that's probably not far
off, I'd prefer seeing relevant search results instead.

~~~
detaro
Far from that bad IMHO, but it has a weird tendency to surface NSFW results,
yes.

~~~
moooo99
Its not that bad with the regular search results. Sometimes porn makes it to
the first result page, usually its on the second or later.

The real problem is when searching for images. I recently had to search for a
lot of images and for basically any search term I entered DDG was able to find
porn. Ultimately, this made me switch back to Google since constantly having
to risk showing NSFW results on your workplace in an open plan office isn't
exactly a great experience.

I'm now using Google at work, Ecosia on my mobile phone and DDG/Google on my
PC/Mac.

------
amelius
I want this but for ads.

~~~
ihuman
Adblock extensions already exist, like uBlock origin

~~~
amelius
Yes, but do they treat the content as an image? Or do they merely hope that
the content is identifiable as an ad through other means?

------
nextaccountic
Does the Tensorflow model run in JS? How fast is that?

Would it be feasible to run the model in wasm or in the GPU?

~~~
rlayton2
I can't speak for this specific model/extension, but "most" neural networks
aren't that big at the end of the day, and you are just a few matrix dot
products away from getting your classification (of course, I'm drastically
simplifying).

Its the training that takes forever, due to the fact all those numbers need
tweaking. However one you have the model, classifying is pretty fast.

~~~
imvetri
Are there tools to visualise trained model,?

~~~
rlayton2
Something like this:
[https://www.tensorflow.org/tensorboard](https://www.tensorflow.org/tensorboard)

~~~
imvetri
Something to visualise the models, the one in this link

[https://github.com/nsfw-filter/nsfw-
filter/tree/master/dist/...](https://github.com/nsfw-filter/nsfw-
filter/tree/master/dist/models)

~~~
dc_count
Use netron to visualize model:

[https://lutzroeder.github.io/netron/?url=https://raw.githubu...](https://lutzroeder.github.io/netron/?url=https://raw.githubusercontent.com/nsfw-
filter/nsfw-filter/master/dist/models/model.json)

~~~
tantalor
> Wait, it's all a DAG?

>> Always has been.

~~~
dc_count
The brain is a heavily cyclic graph. We're not there yet ;)

------
bullman
disappointed this is not called "hotdog / not hotdog"

------
pledg
This would be too late in my workplace, as they'd be logged that I downloaded
the images. That I didn't see them in my browser would be irrelevant.

~~~
gvjddbnvdrbv
I'm curious how workplaces do this. Does they have a root cert installed so
they can MITM SSL traffic?

~~~
jwalton
Yes exactly. And, ironically, many of these solutions can make you less safe;
at one of my former employers we had something like this, but the problem is
that since you're getting a cert from the MITM server, you're not able to
inspect the cert from the real server, and at least in the case of the Cisco
product we were using, the MITM server wouldn't bother to inspect it either;
expired certs, certs with the wrong CN, self signed cert, didn't matter - the
MITM server would ignore the problem and happily replace the cert with a valid
one signed by the company CA.

~~~
unethical_ban
That is more often a configuration issue than a technology issue. MITM proxies
can be configured to reset connections to sites with invalid/expired
certificates.

------
e12e
I was qurious about the classifier, and as expected it appears to be based on
crawling to get the unsafe images - I doubt it's quite in compliance with
neither copyright or gdpr..

The classifier lib:

[https://github.com/alex000kim/nsfw_data_scraper](https://github.com/alex000kim/nsfw_data_scraper)

Announcement points to this data source (while the readme hints at a "premium"
classifier):

[https://github.com/infinitered/nsfwjs](https://github.com/infinitered/nsfwjs)

------
Santosh83
Anyone know of a tool which can process videos (movies) and black/blur out
nude scenes and make the film "family friendly"? The processing doesn't have
to be realtime...

Just to expand: there are many excellent films which are not "family friendly"
only because of 1 or 2 nude scenes which aren't even germane to the overall
plot in many cases. I often wished there was a tool or SaaS that could detect
such scenes and cut or blur them out. Would save a lot of manual processing.

~~~
jasonlfunk
There is a company that was trying to work in this space called VidAngel.
[https://www.vidangel.com/](https://www.vidangel.com/) I used to use them
quite a lot and then they got sued by everyone and now I’m not sure what they
are up too. It’s unclear if a company has the right to offer others content in
a modified form - ie filtering out unacceptable content.

My favorite thing is that they had a JarJar filter for the Star Wars prequels.

~~~
sircastor
They do on the fly skipping in streaming services. Rather than reselling
modified content, they’re skipping time codes.

~~~
jasonlfunk
This must have been their pivot after getting sued. They used to rent filtered
movies for $1.

------
capableweb
If you want to make videos family friendly, it's probably better to aim for
removing violence than nudity, as one is clearly worse for the psych than the
other.

Expansion: how are nude scenes not family friendly? Not trying to start any
flame wars here, just trying to understand how one or two scenes with nudity
suddenly means the video is not family friendly? We all go through life seeing
nudity, so should be fine. Violence however is something we both strive and
should avoid as much as possible.

~~~
pmachinery
Surely it's not that hard to understand that for religious, cultural or other
reasons some people and/or members of their family may feel uncomfortable
seeing nudity.

~~~
capableweb
Yeah, as far as I know, no religions or cultures forbid people to be naked or
see other naked people. What other reasons are you referring to here?

It is indeed hard for me to understand how someone can feel uncomfortable
seeing nudity, as it's everywhere in life and always has been.

~~~
pmachinery
Nudity isn't "everywhere in life", so what is the point of this, since it's
not to start a flame war?

~~~
capableweb
I take a shower in the morning, nude. I go to the beach, there is nude people.
I go to the gym and after taking a shower, nude people. I look at
Instagram/Facebook/Any social media, there will be almost nude people, same
with ads all over the place. Sometimes I sleep naked too. If you have a
family, there is plenty of nudity and can happen at any point. Anyone who
raised a child will give you an idea of how much nudity there really is in
life.

~~~
bishalb
That's like saying you are always nude under your clothes so nudity isn't a
problem. Nudity in movies is like softcore porn and they often come with bed
scenes. Of course if your family is just you and your wife it's fine but I
don't think any sane person would consider that ok for kids.

~~~
ivalm
Why not? I’d definitely be more ok with a soft core scene than some brutal
violence. Sex is normal/good part of life. One should educate kids about sex
(and when it is appropriate) rather than pretend it literally doesn’t exist.

~~~
bishalb
I would say keep kids away from both. Sex isn't something that needs to be
taught, your kids will figure it out when they are ready and old enough.

~~~
ivalm
Yes and no. Teens/young adults will have sex whether you accepts it or not.
However, how they do it and how they feel about it definitely depends on
education.

1\. Sex safety ed needs to be taught, otherwise you get STDs and pregnancies.
A couple of hour lecture in school is not enough. Safe sex practices is
something that has to be reinforced and encouraged.

2\. Respect of consent (and situations where consent cannot happen no matter
what either party says) and understanding how to properly express yourself to
the opposite sex is extremely important. Our society is full of people who do
not treat the opposite gender fairly and do not understand the importance of
enthusiastic consent in intimacy.

3\. Normalizing sex positive attitude. Many people feel shame from sex/shame
others for sexual behavior/repress their own natural desires/etc, this needs
to be counterbalanced, especially in a puritanically perverted society like
the US.

------
umvi
Now just make a version that whites-out NSFW text in e-books and market it to
Utahns as a way to read PG-13 versions of Game of Thrones books and you'll be
rich.

However, you'll probably also be sued into oblivion by angry
authors/publishers who don't like people modifying what they read in any way.

~~~
KMnO4
I know that’s tongue in cheek, but I’d really appreciate having a NSFW text
filter.

Some of my CX team is getting harassed by trolls who send profane messages and
racial slurs through the Zendesk Chat interface. Zendesk does not have a way
to filter out profanity (for Chat at least; there are options for emails or
tickets).

I’ve found simple client side extensions that can censor words, but a better
approach would use NLP to grasp the context.

“I hope you die” contains the same words as “My <product> got wet, I hope it
didn’t die”, but with vastly different intention.

~~~
dexen
Google Jigsaw might have what you are looking for, under the "Harassment"
headline [1]. Note however both Google (Alphabet, really) and the tool
specifically, were accused of various forms of bias [2] by various sides of
discourse.

\--

[1] [https://jigsaw.google.com/issues/](https://jigsaw.google.com/issues/)

[2] for example [https://boingboing.net/2019/08/14/white-aligned-
english.html](https://boingboing.net/2019/08/14/white-aligned-english.html)

------
aasasd
I happen to not be afraid of boobs, so ever since my days on Reddit I wish for
blocking of random gore instead. This is weirdly pertinent sometimes on DDG's
image search.

Edit: to clarify, I'm not afraid of some killing either, thanks to the pop
culture of the past seventy years or so. Now, why eye-hurting images of bodily
damage pop up on rather innocent searches—that's a haunting mystery. On
Reddit, the ‘NSFW’ label is used equally for a vaguely sexually suggestive
shape or a close-up more suitable for a surgical journal. As if I didn't get
plenty of suggestiveness just from music videos anyway! So my long-standing
wish was for an ‘NSFL’ filter instead.

~~~
azalemeth
I have never understood how acts of love (at best) or reproduction (at the
least) are considered in some societies to be dangerous, shocking, and in need
of the strictest censorship -- or at the very least, not on prime-time TV. Yet
acts of war, killing, maiming, and violence in general are often the mainstay
of entertainment.

Sex is part of human nature – and, I would argue, a much bigger and better
part of it than violence and aggression. Why do we hide from it?

~~~
jpxw
People want to avoid the porn industry because it’s sleazy, predatory, and
reduces sex to a commodity.

~~~
rimliu
And murder is ok?

~~~
bishalb
You deduced that from his comment?

------
zmix
I'd rather have every news about the Trumpeteer blocked.

------
raister
My kid would just turn off the extension and keep his business going... :'(

~~~
Darmody
This is not a parental control software. It's made for you to be able to
browse the web without worrying about NSFW images.

~~~
pjmlp
Luckily in Europe, that is hardly an issue as most countries are quite alright
with their bodies and sexualities.

~~~
saagarjha
I'm curious: how would you boss react to such an image appearing on your
monitor? Is this considered "OK" in a European workplace?

~~~
Darmody
That depends.

If you're doing your work and something NSFW pops on your screen I doubt your
boss will give a fuck.

If you're spending your time watching NSFW stuff in your work time he'll
probably be mad, not because of the NSFW stuff but because you're not doing
your work.

------
olliej
Has anyone confirmed it isnt tagging non-pornographic images? Breastfeeding,
breast exam tutorials, sand dunes, etc

Has anyone tested to see if it correctly handles PoC? That demo site it points
to almost exclusively light skinned folk.

These are the basic things I’d want confirmation of.

