1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6
7 # build-system
8 setuptools,
9
10 # dependencies
11 lap,
12 matplotlib,
13 opencv-python,
14 pandas,
15 pillow,
16 psutil,
17 py-cpuinfo,
18 pyyaml,
19 requests,
20 scipy,
21 seaborn,
22 torch,
23 torchvision,
24 tqdm,
25 ultralytics-thop,
26
27 # tests
28 pytestCheckHook,
29 onnx,
30 onnxruntime,
31}:
32
33buildPythonPackage rec {
34 pname = "ultralytics";
35 version = "8.3.174";
36 pyproject = true;
37
38 src = fetchFromGitHub {
39 owner = "ultralytics";
40 repo = "ultralytics";
41 tag = "v${version}";
42 hash = "sha256-wQ16e67ldrV8KwAXoLyxqzx9DG+LAmU5Mt+65dQzUkY=";
43 };
44
45 build-system = [ setuptools ];
46
47 pythonRelaxDeps = [
48 "numpy"
49 ];
50
51 dependencies = [
52 lap
53 matplotlib
54 opencv-python
55 pandas
56 pillow
57 psutil
58 py-cpuinfo
59 pyyaml
60 requests
61 scipy
62 scipy
63 seaborn
64 torch
65 torchvision
66 tqdm
67 ultralytics-thop
68 ];
69
70 pythonImportsCheck = [ "ultralytics" ];
71
72 nativeCheckInputs = [
73 pytestCheckHook
74 onnx
75 onnxruntime
76 ];
77
78 enabledTestPaths = [
79 # rest of the tests require internet access
80 "tests/test_python.py"
81 ];
82
83 disabledTests = [
84 # also remove the individual tests that require internet
85 "test_all_model_yamls"
86 "test_data_annotator"
87 "test_labels_and_crops"
88 "test_model_embeddings"
89 "test_model_methods"
90 "test_predict_callback_and_setup"
91 "test_predict_grey_and_4ch"
92 "test_predict_img"
93 "test_predict_txt"
94 "test_predict_visualize"
95 "test_results"
96 "test_train_pretrained"
97 "test_train_scratch"
98 "test_utils_torchutils"
99 "test_val"
100 "test_workflow"
101 "test_yolo_world"
102 "test_yolov10"
103 "test_yoloe"
104 "test_multichannel"
105 ]
106 ++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) [
107 # Fatal Python error: Aborted
108 # onnxruntime/capi/_pybind_state.py", line 32 in <module>
109 "test_utils_benchmarks"
110 ]
111 ++ lib.optionals stdenv.hostPlatform.isDarwin [
112 # Fatal Python error: Aborted
113 # ultralytics/utils/checks.py", line 598 in check_imshow
114 "test_utils_checks"
115
116 # RuntimeError: required keyword attribute 'value' has the wrong type
117 "test_utils_benchmarks"
118 ];
119
120 meta = {
121 homepage = "https://github.com/ultralytics/ultralytics";
122 changelog = "https://github.com/ultralytics/ultralytics/releases/tag/${src.tag}";
123 description = "Train YOLO models for computer vision tasks";
124 mainProgram = "yolo";
125 license = lib.licenses.agpl3Only;
126 maintainers = with lib.maintainers; [ osbm ];
127 };
128}