Unverified Commit 8ff900b1 authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

python3Packages.mtcnn: init at 0.1.1; python3Packages.retinaface: init at...

python3Packages.mtcnn: init at 0.1.1; python3Packages.retinaface: init at 0.0.17; python3Packages.deepface: init at 0.0.92 (#347052)
parents de4883c8 ac767928
Loading
Loading
Loading
Loading
+80 −0
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  fire,
  flask,
  flask-cors,
  gdown,
  gunicorn,
  mtcnn,
  numpy,
  opencv4,
  pandas,
  pillow,
  pythonOlder,
  requests,
  retinaface,
  setuptools,
  tensorflow,
  tqdm,
}:

buildPythonPackage rec {
  pname = "deepface";
  version = "0.0.92";
  pyproject = true;

  disabled = pythonOlder "3.7";

  src = fetchFromGitHub {
    owner = "serengil";
    repo = "deepface";
    rev = "refs/tags/v${version}";
    hash = "sha256-Vjm8lfpGyJ7/1CUwIvxXxHqwmv0+iKewYV3vE08gpPQ=";
  };

  postPatch = ''
    # prevent collisions
    substituteInPlace setup.py \
      --replace-fail "data_files=[(\"\", [\"README.md\", \"requirements.txt\", \"package_info.json\"])]," "" \
      --replace-fail "install_requires=requirements," ""

    substituteInPlace deepface/detectors/OpenCv.py \
      --replace-fail "opencv_home = cv2.__file__" "opencv_home = os.readlink(cv2.__file__)" \
      --replace-fail "folders = opencv_home.split(os.path.sep)[0:-1]" "folders = opencv_home.split(os.path.sep)[0:-4]" \
      --replace-fail "return path + \"/data/\"" "return path + \"/share/opencv4/haarcascades/\""
  '';

  build-system = [ setuptools ];

  dependencies = [
    fire
    flask
    flask-cors
    gdown
    gunicorn
    mtcnn
    numpy
    opencv4
    pandas
    pillow
    requests
    retinaface
    tensorflow
    tqdm
  ];

  # requires internet connection
  doCheck = false;

  pythonImportsCheck = [ "deepface" ];

  meta = {
    description = "Lightweight Face Recognition and Facial Attribute Analysis (Age, Gender, Emotion and Race) Library for Python";
    homepage = "https://github.com/serengil/deepface";
    changelog = "https://github.com/serengil/deepface/releases/tag/v${version}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ derdennisop ];
  };
}
+53 −0
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  opencv4,
  pytestCheckHook,
  pythonOlder,
  setuptools,
  tensorflow,
}:

buildPythonPackage {
  pname = "mtcnn";
  version = "0.1.1";
  pyproject = true;

  disabled = pythonOlder "3.7";

  src = fetchFromGitHub {
    owner = "ipazc";
    repo = "mtcnn";
    # No tags / releases; using commit: https://github.com/ipazc/mtcnn/commit/3208d443a8f01d317c65d7c97a03bc0a6143c41d
    rev = "3208d443a8f01d317c65d7c97a03bc0a6143c41d";
    hash = "sha256-GXUrLJ5XD6V2hT/gjyYSuh/CMMw2xIXKBsYFvQmbLYs=";
  };

  postPatch = ''
    substituteInPlace setup.py \
      --replace-fail "setup, setuptools" "setup, find_packages"\
      --replace-fail "setuptools.find_packages" "find_packages"\
      --replace-fail "opencv-python>=4.1.0" ""\
      --replace-fail "keras>=2.0.0" ""\
      --replace-fail "tests_require=['nose']," ""
  '';

  build-system = [ setuptools ];

  dependencies = [
    opencv4
    tensorflow
  ];

  pythonImportsCheck = [ "mtcnn" ];

  nativeCheckInputs = [ pytestCheckHook ];

  meta = {
    description = "MTCNN face detection implementation for TensorFlow";
    homepage = "https://github.com/ipazc/mtcnn";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ derdennisop ];
  };
}
+64 −0
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  gdown,
  numpy,
  opencv4,
  pillow,
  pytestCheckHook,
  pythonOlder,
  setuptools,
  tensorflow,
}:

buildPythonPackage rec {
  pname = "retinaface";
  version = "0.0.17";
  pyproject = true;

  disabled = pythonOlder "3.7";

  src = fetchFromGitHub {
    owner = "serengil";
    repo = "retinaface";
    rev = "refs/tags/v${version}";
    hash = "sha256-0s1CSGlK2bF1F2V/IuG2ZqD7CkNfHGvp1M5C3zDnuKs=";
  };

  postPatch = ''
    # prevent collisions
    substituteInPlace setup.py \
      --replace-fail "data_files=[(\"\", [\"README.md\", \"requirements.txt\", \"package_info.json\"])]," "" \
      --replace-fail "install_requires=requirements," ""
  '';

  # requires internet connection
  disabledTestPaths = [
    "tests/test_actions.py"
    "tests/test_align_first.py"
    "tests/test_expand_face_area.py"
  ];

  build-system = [ setuptools ];

  dependencies = [
    gdown
    numpy
    opencv4
    pillow
    tensorflow
  ];

  nativeCheckInputs = [ pytestCheckHook ];

  pythonImportsCheck = [ "retinaface" ];

  meta = {
    description = "Deep Face Detection Library for Python";
    homepage = "https://github.com/serengil/retinaface";
    changelog = "https://github.com/serengil/retinaface/releases/tag/v${version}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ derdennisop ];
  };
}
+6 −0
Original line number Diff line number Diff line
@@ -3034,6 +3034,8 @@ self: super: with self; {
  deepdish = callPackage ../development/python-modules/deepdish { };
  deepface = callPackage ../development/python-modules/deepface { };
  deepl = callPackage ../development/python-modules/deepl { };
  deepmerge = callPackage ../development/python-modules/deepmerge { };
@@ -8248,6 +8250,8 @@ self: super: with self; {
  msrest = callPackage ../development/python-modules/msrest { };
  mtcnn = callPackage ../development/python-modules/mtcnn { };
  mt-940 = callPackage ../development/python-modules/mt-940 { };
  mullvad-api = callPackage ../development/python-modules/mullvad-api { };
@@ -13627,6 +13631,8 @@ self: super: with self; {
  rethinkdb = callPackage ../development/python-modules/rethinkdb { };
  retinaface = callPackage ../development/python-modules/retinaface { };
  retry = callPackage ../development/python-modules/retry { };
  retry-decorator = callPackage ../development/python-modules/retry-decorator { };