photo_analyzer 0.2.2 copy "photo_analyzer: ^0.2.2" to clipboard
photo_analyzer: ^0.2.2 copied to clipboard

A Flutter package for photo analyzer that detects faces, estimates gender, and classifies NSFW (Not Safe for Work) content. This package uses advanced algorithms to analyze images and extract relevant [...]

My Flutter Package #

A Flutter package for image processing that detects faces, estimates gender, and classifies NSFW (Not Safe for Work) content. This package uses advanced algorithms to analyze images and extract relevant data for face detection, demographic estimation, and content filtering.

Features #

  • Face Detection: Detects faces in images and returns their locations.
  • Gender Estimation: Estimates the gender of detected faces.
  • NSFW Content Classification: Classifies images as NSFW or safe for work.

Installation #

To use this package, add it to your pubspec.yaml file:

dependencies:
  photo_analyzer: 0.2.2
  final _photoAnalyzerPlugin = PhotoAnalyzer();

  Future<void> initilizeModel() async{
    await _photoAnalyzerPlugin.initilizeModel(threshold: 0.5);
  }

  Future<void> detectNSFW() async {
    try {
      final ByteData data = await rootBundle.load('assets/nsfw.jpeg');
      final Uint8List imageData = data.buffer.asUint8List();
      final result = await _photoAnalyzerPlugin.nsfwDetection(image: imageData);
      debugPrint(result);
    } on PlatformException catch (e) {
      debugPrint(e.toString());
    }
  }

  Future<void> detectFace() async {
    try {
      final ByteData data = await rootBundle.load('assets/bikini.jpeg');
      final Uint8List imageData = data.buffer.asUint8List();
      final result = await _photoAnalyzerPlugin.detectFaces(image: imageData);
      setState(() {
        bytesList = result.cast<Uint8List>();
      });
    } on PlatformException catch (e) {
      debugPrint(e.toString());
    }
  }

  Future<void> detectGender() async {
    try {
      final ByteData data = await rootBundle.load('assets/male.jpg');
      final Uint8List imageData = data.buffer.asUint8List();
      final result =
          await _photoAnalyzerPlugin.genderPrediction(image: imageData);

      debugPrint(result);
    } on PlatformException catch (e) {
      debugPrint(e.toString());
    }
  }


# add this line:
$iOSVersion = '15.5' 


target 'Runner' do
  use_frameworks!
  # add this line:
  pod 'GoogleMLKit/FaceDetection', '7.0.0'
  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
  target 'RunnerTests' do
    inherit! :search_paths
  end
end




post_install do |installer|
  # add these lines:
  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[sdk=*]"] = "armv7"
    config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = $iOSVersion
  end

  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)

    # add these lines:
    target.build_configurations.each do |config|
      if Gem::Version.new($iOSVersion) > Gem::Version.new(config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'])
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = $iOSVersion
      end
    end
  end
end
1
likes
0
points
19
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package for photo analyzer that detects faces, estimates gender, and classifies NSFW (Not Safe for Work) content. This package uses advanced algorithms to analyze images and extract relevant data for face detection, demographic estimation, and content filtering.

License

unknown (license)

Dependencies

flutter, image, tflite_flutter

More

Packages that depend on photo_analyzer

Packages that implement photo_analyzer