An NSFW image detector for Swift built as an extension on UIImage.

Overview

Swift_NSFW_Detector

An NSFW image detector for Swift built as an extension on UIImage.

If you've ever allowed users to share images you are probably wishing you had implemented a 'hotdog' filter. Now you can easily filter images when they are selected or before they are shared.

The MLModel used in this implementation is Yahoo's OpenNSFW.mlmodel

Based on https://github.com/kashif/NsfwDetector this extension makes implementation much simpler.

Installation

Copy NSFWDetector.swift and OpenNSFW.mlmodel into your project and you're done.

Sample usage:

let image = UIImage(...)
image.checkNSFW() { result, confidence in
  switch result {
    case .sfw:
      self.allowImage()
    case .nsfw:
      if conficence > 0.5 {
        self.blockImage()
      } else {
        self.allowImage()
      }
    case .unknown:
      self.flagImage()
  }
}
You might also like...
Async image downloader with Mem&Disk cached as a UIImageView extension

HBWebImage Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements Installation HBWebIm

AYImageKit is a Swift Library for Async Image Downloading, Show Name's Initials and Can View image in Separate Screen.
AYImageKit is a Swift Library for Async Image Downloading, Show Name's Initials and Can View image in Separate Screen.

AYImageKit AYImageKit is a Swift Library for Async Image Downloading. Features Async Image Downloading. Can Show Text Initials. Can have Custom Styles

Random image generator built with Swift

Ody Ody is an easy to use random image generator built with Swift. Perfect for placeholders! Built with [Silo] silojq, [LoremPixel] images, and FillDu

📷 A composable image editor using Core Image and Metal.
📷 A composable image editor using Core Image and Metal.

Brightroom - Composable image editor - building your own UI Classic Image Editor PhotosCrop Face detection Masking component 🎉 v2.0.0-alpha now open!

📷 A composable image editor using Core Image and Metal.
📷 A composable image editor using Core Image and Metal.

Brightroom - Composable image editor - building your own UI Classic Image Editor PhotosCrop Face detection Masking component 🎉 v2.0.0-alpha now open!

AsyncImage before iOS 15. Lightweight, pure SwiftUI Image view, that displays an image downloaded from URL, with auxiliary views and local cache.

URLImage URLImage is a SwiftUI view that displays an image downloaded from provided URL. URLImage manages downloading remote image and caching it loca

A complete Mac App: drag an image file to the top section and the bottom section will show you the text of any QRCodes in the image.

QRDecode A complete Mac App: drag an image file to the top section and the bottom section will show you the text of any QRCodes in the image. QRDecode

Convert the image to hexadecimal to send the image to e-paper

ConvertImageToHex Convert the image to hexadecimal to send the image to e-paper Conversion Order // 0. hex로 변환할 이미지 var image = UIImage(named: "sample

Twitter Image Pipeline is a robust and performant image loading and caching framework for iOS clients

Twitter Image Pipeline (a.k.a. TIP) Background The Twitter Image Pipeline is a streamlined framework for fetching and storing images in an application

Owner
Chris Brown
Chris Brown
SwiftGif - A small UIImage extension with gif support.

SwiftGif - A small UIImage extension with gif support.

SwiftGif 1.3k Dec 20, 2022
An image download extension of the image view written in Swift for iOS, tvOS and macOS.

Moa, an image downloader written in Swift for iOS, tvOS and macOS Moa is an image download library written in Swift. It allows to download and show an

Evgenii Neumerzhitckii 330 Sep 9, 2022
TextDrawer, is a UIView allows you to add text, with gesture, on UIView, or UIImage

TextDrawer TextDrawer, is a UIView allows you to add text, with gesture, on UIView, or UIImage. About Annotating Images TextDrawer is the easiest way

Remi ROBERT 106 Dec 18, 2022
IOS UIImage processing functions using the vDSP/Accellerate framework for speed.

UIImage Image Processing extensions using the vDSP/Accelerate framework.

null 372 Sep 1, 2022
A view controller for iOS that allows users to crop portions of UIImage objects

TOCropViewController TOCropViewController is an open-source UIViewController subclass to crop out sections of UIImage objects, as well as perform basi

Tim Oliver 4.4k Jan 1, 2023
Convert UIImage to ASCII art

BKAsciiImage As seen on Cmd.fm iOS App https://itunes.apple.com/app/cmd.fm-radio-for-geeks-hackers/id935765356 Installation BKAsciiImage is available

Barış Koç 427 Dec 17, 2022
SwiftColorArt is a demo application that includes Swift files with all classes and extension necessary to create a font color schema matching to an image

SwiftColorArt SwiftColorArt is a demo application that includes Swift files with all classes and extension necessary to create a font color schema mat

Jan Gregor Triebel 264 Jan 4, 2023
A simple UIImageView extension for using initials as a profile image, written in swift

InitialsImageView An easy, helpful UIImageView extension that generates letter initials as a placeholder for user profile images, with a randomized ba

Tom Bachant 215 Dec 17, 2022
Siri Shortcuts extension for calculating NN-based image hash.

NNHash Siri Shortcuts extension for calculating NN-based image hash. Based on nhcalc.

Yi Xie 3 Aug 9, 2021
An extension that gives UIImageView the ability to focus on faces within an image.

FaceAware Sometimes the aspect ratios of images we need to work with don't quite fit within the confines of our UIImageViews. In most cases we can use

Beau Nouvelle 3k Jan 3, 2023