I am new to neural networks, I've only started studying and learning about the subject a year ago, and I just started building my first neural network.

The project is a little bit ambitious: A browser extension for children's safety, it checks for sexual or abusive content, so that it replaces that content with a placeholder, the user will have to insert a password to show original content.

I didn't find a dataset online, so I decided to build my training dataset. So, I started by writing a web crawler, it starts collecting images, meanwhile implementing data augmentation techniques. It basically resizes images (to 95x95), crops them, rotates, changes colors, adds blur, black and white, noise, etc.

The problem is that after applying these techniques, I noticed that some images are not even recognizable by a human subject.

I mean that even though I know that picture contains sexual content, it doesn't even appear to be sexual anymore.

So, do I have to label it as sexual or not sexual?

Notice that it's easier for me to consider it as sexual, if every image produces about 50 edited images, I'd only have to label the original image, what follows is that all 50 images get the same label. Is it okay to do just that?

enter image description here

This is a sample of what I get after doing data augmentation, notice that some pictures are not recognizable by humans.

For example, look at the result after editing images hue and saturation, a human can't recognize this result, is it okay to label it: not sexual?

enter image description here enter image description here

I wouldn't recognize the picture on the right if I didn't see the original one.

I also tested this on human subjects (my brothers), they didn't recognize the squirrel on the right.


1 Answer 1


Yes, you should label it the same. But more importantly you need to make sure that each perturbation of the image doesn't change some important character of the image.

Consider training an apple classifier. If you plan to augment data by altering the RGB values, you need to be wary that you might cause issues in classification tasks where color is instrumental. Say, Granny apple / Fuji apple. If you still really want to augment data in this way, consider perturbing by smaller amounts each time.

Or consider an apple detector. An apple still "looks to be an apple" if looked at an angle, if looked through a mirror, if looked afar, but probably not if looked through a carnival mirror.

So ask yourself, if an image still NSFW if the colors are changed?

However, as a personal anecdote I don't think augmenting data by changing the color channel is a good idea. Also note that training on augmented data by altering the color channels as a whole should be more or less equivalent to training in B/W. Why?

  • $\begingroup$ Thank you so much for your answer, Yes, I agree with you .. now, I think that it might be better to convert all images to B/W (that would decrease the number of input neurons) ... And focus only on shape, since abusive and sexual content can be recognized without colors. If I train my Network with B/W image dataset, do I have to convert input images to B/W if I were to check them? $\endgroup$
    – SmootQ
    Commented Jan 14, 2018 at 23:28
  • 1
    $\begingroup$ Yes, since that's the type of image it was trained on $\endgroup$ Commented Jan 15, 2018 at 16:46
  • 1
    $\begingroup$ This is relevant: github.com/yahoo/open_nsfw/blob/master/README.md $\endgroup$ Commented Jan 15, 2018 at 16:47
  • $\begingroup$ The kind of augmentations you seem to be doing will render your data set useless to a CNN classifier because you are randomly altering important features of the image. I recommend that you use the keras ImageDataGenerator to achieve the augmentations you desire. Documentation is at keras.io/preprocessing/image. $\endgroup$
    – Gerry P
    Commented Mar 6, 2020 at 8:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .