matchypatchy 0.2.1rc1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. matchypatchy-0.2.1rc1/LICENSE +21 -0
  2. matchypatchy-0.2.1rc1/PKG-INFO +195 -0
  3. matchypatchy-0.2.1rc1/README.md +180 -0
  4. matchypatchy-0.2.1rc1/pyproject.toml +42 -0
  5. matchypatchy-0.2.1rc1/setup.cfg +4 -0
  6. matchypatchy-0.2.1rc1/src/matchypatchy/__init__.py +105 -0
  7. matchypatchy-0.2.1rc1/src/matchypatchy/__main__.py +78 -0
  8. matchypatchy-0.2.1rc1/src/matchypatchy/assets/graphics/desktop_icon.ico +0 -0
  9. matchypatchy-0.2.1rc1/src/matchypatchy/assets/graphics/desktop_icon.png +0 -0
  10. matchypatchy-0.2.1rc1/src/matchypatchy/assets/graphics/fluent_pencil_icon.png +0 -0
  11. matchypatchy-0.2.1rc1/src/matchypatchy/assets/graphics/logo.png +0 -0
  12. matchypatchy-0.2.1rc1/src/matchypatchy/assets/graphics/thumbnail_notfound.png +0 -0
  13. matchypatchy-0.2.1rc1/src/matchypatchy/assets/models.yml +25 -0
  14. matchypatchy-0.2.1rc1/src/matchypatchy/assets/schema.txt +107 -0
  15. matchypatchy-0.2.1rc1/src/matchypatchy/config.py +188 -0
  16. matchypatchy-0.2.1rc1/src/matchypatchy/database/__init__.py +35 -0
  17. matchypatchy-0.2.1rc1/src/matchypatchy/database/location.py +165 -0
  18. matchypatchy-0.2.1rc1/src/matchypatchy/database/media.py +231 -0
  19. matchypatchy-0.2.1rc1/src/matchypatchy/database/mpdb.py +958 -0
  20. matchypatchy-0.2.1rc1/src/matchypatchy/database/setup.py +158 -0
  21. matchypatchy-0.2.1rc1/src/matchypatchy/database/thumbnails.py +150 -0
  22. matchypatchy-0.2.1rc1/src/matchypatchy/gui/__init__.py +65 -0
  23. matchypatchy-0.2.1rc1/src/matchypatchy/gui/dialogs/__init__.py +40 -0
  24. matchypatchy-0.2.1rc1/src/matchypatchy/gui/dialogs/popup_alert.py +82 -0
  25. matchypatchy-0.2.1rc1/src/matchypatchy/gui/dialogs/popup_config.py +384 -0
  26. matchypatchy-0.2.1rc1/src/matchypatchy/gui/dialogs/popup_import_csv.py +274 -0
  27. matchypatchy-0.2.1rc1/src/matchypatchy/gui/dialogs/popup_import_folder.py +137 -0
  28. matchypatchy-0.2.1rc1/src/matchypatchy/gui/dialogs/popup_individual.py +206 -0
  29. matchypatchy-0.2.1rc1/src/matchypatchy/gui/dialogs/popup_media_edit.py +658 -0
  30. matchypatchy-0.2.1rc1/src/matchypatchy/gui/dialogs/popup_ml.py +255 -0
  31. matchypatchy-0.2.1rc1/src/matchypatchy/gui/dialogs/popup_pairx.py +83 -0
  32. matchypatchy-0.2.1rc1/src/matchypatchy/gui/dialogs/popup_readme.py +36 -0
  33. matchypatchy-0.2.1rc1/src/matchypatchy/gui/dialogs/popup_station.py +178 -0
  34. matchypatchy-0.2.1rc1/src/matchypatchy/gui/dialogs/popup_survey.py +238 -0
  35. matchypatchy-0.2.1rc1/src/matchypatchy/gui/dialogs/popup_uploads.py +236 -0
  36. matchypatchy-0.2.1rc1/src/matchypatchy/gui/display_base.py +361 -0
  37. matchypatchy-0.2.1rc1/src/matchypatchy/gui/display_compare.py +858 -0
  38. matchypatchy-0.2.1rc1/src/matchypatchy/gui/display_media.py +648 -0
  39. matchypatchy-0.2.1rc1/src/matchypatchy/gui/main_gui.py +393 -0
  40. matchypatchy-0.2.1rc1/src/matchypatchy/gui/manual_query.py +332 -0
  41. matchypatchy-0.2.1rc1/src/matchypatchy/gui/media_table.py +241 -0
  42. matchypatchy-0.2.1rc1/src/matchypatchy/gui/qc_query.py +308 -0
  43. matchypatchy-0.2.1rc1/src/matchypatchy/gui/query.py +611 -0
  44. matchypatchy-0.2.1rc1/src/matchypatchy/gui/widgets/__init__.py +29 -0
  45. matchypatchy-0.2.1rc1/src/matchypatchy/gui/widgets/gui_assets.py +320 -0
  46. matchypatchy-0.2.1rc1/src/matchypatchy/gui/widgets/widget_filterbar.py +279 -0
  47. matchypatchy-0.2.1rc1/src/matchypatchy/gui/widgets/widget_image_adjustment.py +129 -0
  48. matchypatchy-0.2.1rc1/src/matchypatchy/gui/widgets/widget_media.py +596 -0
  49. matchypatchy-0.2.1rc1/src/matchypatchy/logging_config.py +54 -0
  50. matchypatchy-0.2.1rc1/src/matchypatchy/threads/__init__.py +36 -0
  51. matchypatchy-0.2.1rc1/src/matchypatchy/threads/animl_thread.py +275 -0
  52. matchypatchy-0.2.1rc1/src/matchypatchy/threads/import_thread.py +739 -0
  53. matchypatchy-0.2.1rc1/src/matchypatchy/threads/match_object.py +231 -0
  54. matchypatchy-0.2.1rc1/src/matchypatchy/threads/match_thread.py +180 -0
  55. matchypatchy-0.2.1rc1/src/matchypatchy/threads/model_download_thread.py +160 -0
  56. matchypatchy-0.2.1rc1/src/matchypatchy/threads/reid_thread.py +161 -0
  57. matchypatchy-0.2.1rc1/src/matchypatchy/threads/sequence_thread.py +75 -0
  58. matchypatchy-0.2.1rc1/src/matchypatchy/threads/table_thread.py +159 -0
  59. matchypatchy-0.2.1rc1/src/matchypatchy.egg-info/PKG-INFO +195 -0
  60. matchypatchy-0.2.1rc1/src/matchypatchy.egg-info/SOURCES.txt +61 -0
  61. matchypatchy-0.2.1rc1/src/matchypatchy.egg-info/dependency_links.txt +1 -0
  62. matchypatchy-0.2.1rc1/src/matchypatchy.egg-info/requires.txt +3 -0
  63. matchypatchy-0.2.1rc1/src/matchypatchy.egg-info/top_level.txt +1 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Conservation Technology Lab
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,195 @@
1
+ Metadata-Version: 2.4
2
+ Name: matchypatchy
3
+ Version: 0.2.1rc1
4
+ Summary: GUI tool for human validation of AI-powered animal re-identification
5
+ Author-email: Kyra Swanson <tswanson@sdzwa.org>
6
+ Project-URL: Homepage, https://github.com/onservationtechlab/matchypatchy
7
+ Project-URL: Issues, https://github.com/onservationtechlab/matchypatchy/issues
8
+ Requires-Python: >=3.12
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Requires-Dist: animl-lite==3.3.2
12
+ Requires-Dist: chromadb>=1.3.4
13
+ Requires-Dist: pyqt6>=6.9.0
14
+ Dynamic: license-file
15
+
16
+ # MatchyPatchy
17
+ <br/>
18
+
19
+ [User Manual](https://conservationtechlab.github.io/matchypatchy/)
20
+
21
+ MatchyPatchy is an open-source GUI tool for human validation of AI-powered animal re-identification.\
22
+ It was developed by the San Diego Zoo Wildlife Alliance Conservation Technology Lab.\
23
+ Author: Kyra Swanson, (c) 2025
24
+ <br/>
25
+
26
+ ---
27
+ ## Installation
28
+
29
+ Matchypatchy is a stand-alone executable built in Python. Download it [here](). \
30
+ [Github Repository](https://github.com/conservationtechlab/matchypatchy)
31
+ <br/>
32
+
33
+ ---
34
+ ## Getting Started
35
+ <br/>
36
+
37
+ ### Download Models
38
+ In order to calculate potential matches, MatchyPatchy requires an animal object detector such as [MegaDetector]()
39
+ and an embedding extractor such as [MiewID](). Both models and more can be obtained from the SDZWA server by selecting
40
+ 'Download Models' and checking the box associated with which models you want to download.
41
+ <br/>
42
+
43
+ ### Select Survey
44
+ In order to add media to the database, you must first specify a Survey using
45
+ the dropdown of available surveys. To add a new survey,
46
+
47
+ 1. Select 'Manage Surveys'
48
+ 2. Select 'New'
49
+ 3. Enter Survey Name
50
+ 4. Enter Survey Region
51
+ 5. (Optional) Enter Survey Start Year
52
+ 6. (Optional) Enter Survey End Year
53
+ 7. Select 'Ok'
54
+ <br/>
55
+
56
+ ### 1. Import Images
57
+ Images can be imported via spreadsheet or by manually selecting a directory of images.
58
+
59
+ **From CSV**
60
+ 1. Select '1. Import from CSV'
61
+ 2. Open .csv file
62
+ 3. Select column headers that correspond to image Filepath, Timestamp, Survey, and Station
63
+ 4. Optionally select column headers that correspond to image Region, Sequence ID, External ID,
64
+ Viewpoint, Species, Individual ID, and Comment
65
+ 5. Select 'Ok'
66
+ <br/>
67
+
68
+ **From Folder**
69
+ 1. Select '1. Import from Folder'
70
+ 2. Open directory containing image files. Can be a whole Survey containg multiple Stations or single Station.
71
+ 3. Select the directory level that corresponds to Station name if available
72
+ 4. Select 'Ok'
73
+ <br/>
74
+
75
+ ### 2. Process Images
76
+ Run images through a sequence of AI models to obtain predicted matches.\
77
+ Note: Models must be accessible in MatchyPatchy's "Models" folder - see Configuration for more.
78
+
79
+ 1. Select '2. Process'
80
+ 2. (Optional) Check Calculate Sequence (improves performance for videos and images captured in quick succession)
81
+ 3. **Select Detector Model** - recommended MegaDetector v5a
82
+ 4. (Optional) Select Species Classifier Model
83
+ 5. **Select Re-Indentification Model** - required to obtain predicted matches, recommended MiewIDv3
84
+ 6. (Optional) Select Viewpoint Model (improves performance by estimating animal viewpoint and limiting search space)
85
+ <br/>
86
+
87
+ ### 3. Validate
88
+ After processing, this pageview allows you to review the imported media for errors, make changes, delete images, etc.
89
+ It can be accessed at any time after image import.
90
+ <br/>
91
+
92
+ Double-clicking on a cell will allow you to edit it.\
93
+ Double-clicking on a single row will pull up a screen to edit multiple fields for an image.\
94
+ Selecting one or more row (either by clicking on the row number or checking the select box) will enable the ability
95
+ to mass edit particular fields, duplicate entries, or delete entries.
96
+ <br/>
97
+
98
+ The **"Show"** Option allows you view the full images or detected ROIS.\
99
+ The **"Save"** Option saves all edits to the database.\
100
+ The **"Undo"** Option undoes the last edit made.
101
+ <br/>
102
+
103
+ **Filters** \
104
+ Images can be filtered by Region, Survey, Station, Species, and Individual.\
105
+ You can also choose to show only "Unidentified" ROIs.\
106
+ You can also display all images marked as "Favorite"
107
+ <br/>
108
+
109
+ ### 4. Match
110
+ After processing, potential matches can be validated at this pageview.
111
+ The left side contains a **Query** image and the right side contains potential **Matches**.
112
+ If "Calculate Sequence" was selected during the processing stage, the entire **Sequence** will be viewable on the Query side.
113
+ The pageview will display the images and associated metadata.
114
+ <br/>
115
+
116
+ _View Options_\
117
+ Adjustments can be made to the **Maximum Number of Matches** shown for each image (within a sequence) and to the maximum distance
118
+ threshold between the two images to qualify as a match. The **Cosine** or **L2** distance of the Match from the Query is displayed above the
119
+ match image. Select which distance metric to use in the dropdown. You must select **"Recalculate Matches"** if changes are made to either option
120
+ in order to display those changes.\
121
+ After matches are validated, you can **"Query by Individual"** to do quality control and ensure all images associated with
122
+ an individual are indeed valid.\
123
+ Images can be **Filtered** by Region, Survey, or Station to narrow the available matches shown.\
124
+ If **"Viewpoint"** was calculated at the processing step, you can filter both the **Query** and the **Match** images by Viewpoint.\
125
+ The **"View Data"** Button at the bottom brings you to the Media Validation pageview.
126
+ <br/>
127
+
128
+ _Image Options_\
129
+ You can adjust the **Brightness, Contrast** and **Sharpness** of each image, as well as **Zoom** using the mouse scroll wheel.\
130
+ The **"Reset"** button returns the image to its original form.\
131
+ The **"Edit Image"** option allows you to make changes to the metadata.\
132
+ The **"Open Image"** option opens the image in your default image viewer.\
133
+ The **"♥"** option marks the image with the "Favorite" tag.
134
+ <br/>
135
+
136
+ To confirm a match between the Query and the Match image, select the **"Match" button** in the middle, or press the 'M' or 'Space Key'.
137
+ Pressing Match again will undo the match, asking you to confirm first.\
138
+ You can navigate between Query Sequences and Matches by using the **"<<"** and **">>"** buttons, or by using the arrow keys.\
139
+ You can also toggle the **Viewpoint** by pressing 'V'.
140
+ <br/>
141
+
142
+ ### 5. Export
143
+ The database can be exported as a .csv file. Simply select '5. Export' and specify the file name and location.
144
+ <br/>
145
+
146
+ ---
147
+ ## Database Management
148
+ <br/>
149
+
150
+ ### Definitions
151
+ * Survey - An ecological study employing camera traps to investigate wildlife of a particular area.
152
+ * Region - A geographical region that may host one or more camera trap surveys.
153
+ * Station - Reference to a physical location containing one or camera traps.
154
+ * Species - The taxonomic and common names refering to a class of animal.
155
+ * Media - Image (and soon video) files obtained from camera traps.
156
+ * ROI - Regions of Interest within media files that contain animals.
157
+ * Individual - A particular, singular example of a given species, can be named/ID'd.
158
+ * Sequence ID - A unique number associated with a set of sequential images or frames in a video.
159
+ * External ID - A unique number used to reference MatchyPatchy output with other datamanagement tools.
160
+ * Viewpoint - The side of the body of the animl facing the camera, eg "Left", "Right", "Top"
161
+ * Comment - Notes or concerns about a particular media file
162
+ * Favorite - A tag marking an image as noteworthy.
163
+ <br/>
164
+
165
+ ### Manage Tables
166
+ **Survey, Station,** and **Species** tables can be managed independently.
167
+ <br/>
168
+
169
+ ### CSV Import
170
+ <br/>
171
+
172
+
173
+ ---
174
+ ## Configuration
175
+ <br/>
176
+
177
+ ### Available Models
178
+ Models currently available and compatible with MatchyPatchy:\
179
+ _Detector Models_:
180
+ - MegaDetector v5a
181
+ - MegaDetector v5b
182
+
183
+ _Re-ID Models_:
184
+ - MiewID v3
185
+ - MiewID v2
186
+
187
+ _Viewpoint Models_:
188
+ - SDZWA Viewpoint
189
+ <br/>
190
+
191
+ ### Link to New Database
192
+ Database files can be shared across multiple users of MatchyPatchy. To link to a new .db file,
193
+ <br/>
194
+
195
+ ### Clear Data
@@ -0,0 +1,180 @@
1
+ # MatchyPatchy
2
+ <br/>
3
+
4
+ [User Manual](https://conservationtechlab.github.io/matchypatchy/)
5
+
6
+ MatchyPatchy is an open-source GUI tool for human validation of AI-powered animal re-identification.\
7
+ It was developed by the San Diego Zoo Wildlife Alliance Conservation Technology Lab.\
8
+ Author: Kyra Swanson, (c) 2025
9
+ <br/>
10
+
11
+ ---
12
+ ## Installation
13
+
14
+ Matchypatchy is a stand-alone executable built in Python. Download it [here](). \
15
+ [Github Repository](https://github.com/conservationtechlab/matchypatchy)
16
+ <br/>
17
+
18
+ ---
19
+ ## Getting Started
20
+ <br/>
21
+
22
+ ### Download Models
23
+ In order to calculate potential matches, MatchyPatchy requires an animal object detector such as [MegaDetector]()
24
+ and an embedding extractor such as [MiewID](). Both models and more can be obtained from the SDZWA server by selecting
25
+ 'Download Models' and checking the box associated with which models you want to download.
26
+ <br/>
27
+
28
+ ### Select Survey
29
+ In order to add media to the database, you must first specify a Survey using
30
+ the dropdown of available surveys. To add a new survey,
31
+
32
+ 1. Select 'Manage Surveys'
33
+ 2. Select 'New'
34
+ 3. Enter Survey Name
35
+ 4. Enter Survey Region
36
+ 5. (Optional) Enter Survey Start Year
37
+ 6. (Optional) Enter Survey End Year
38
+ 7. Select 'Ok'
39
+ <br/>
40
+
41
+ ### 1. Import Images
42
+ Images can be imported via spreadsheet or by manually selecting a directory of images.
43
+
44
+ **From CSV**
45
+ 1. Select '1. Import from CSV'
46
+ 2. Open .csv file
47
+ 3. Select column headers that correspond to image Filepath, Timestamp, Survey, and Station
48
+ 4. Optionally select column headers that correspond to image Region, Sequence ID, External ID,
49
+ Viewpoint, Species, Individual ID, and Comment
50
+ 5. Select 'Ok'
51
+ <br/>
52
+
53
+ **From Folder**
54
+ 1. Select '1. Import from Folder'
55
+ 2. Open directory containing image files. Can be a whole Survey containg multiple Stations or single Station.
56
+ 3. Select the directory level that corresponds to Station name if available
57
+ 4. Select 'Ok'
58
+ <br/>
59
+
60
+ ### 2. Process Images
61
+ Run images through a sequence of AI models to obtain predicted matches.\
62
+ Note: Models must be accessible in MatchyPatchy's "Models" folder - see Configuration for more.
63
+
64
+ 1. Select '2. Process'
65
+ 2. (Optional) Check Calculate Sequence (improves performance for videos and images captured in quick succession)
66
+ 3. **Select Detector Model** - recommended MegaDetector v5a
67
+ 4. (Optional) Select Species Classifier Model
68
+ 5. **Select Re-Indentification Model** - required to obtain predicted matches, recommended MiewIDv3
69
+ 6. (Optional) Select Viewpoint Model (improves performance by estimating animal viewpoint and limiting search space)
70
+ <br/>
71
+
72
+ ### 3. Validate
73
+ After processing, this pageview allows you to review the imported media for errors, make changes, delete images, etc.
74
+ It can be accessed at any time after image import.
75
+ <br/>
76
+
77
+ Double-clicking on a cell will allow you to edit it.\
78
+ Double-clicking on a single row will pull up a screen to edit multiple fields for an image.\
79
+ Selecting one or more row (either by clicking on the row number or checking the select box) will enable the ability
80
+ to mass edit particular fields, duplicate entries, or delete entries.
81
+ <br/>
82
+
83
+ The **"Show"** Option allows you view the full images or detected ROIS.\
84
+ The **"Save"** Option saves all edits to the database.\
85
+ The **"Undo"** Option undoes the last edit made.
86
+ <br/>
87
+
88
+ **Filters** \
89
+ Images can be filtered by Region, Survey, Station, Species, and Individual.\
90
+ You can also choose to show only "Unidentified" ROIs.\
91
+ You can also display all images marked as "Favorite"
92
+ <br/>
93
+
94
+ ### 4. Match
95
+ After processing, potential matches can be validated at this pageview.
96
+ The left side contains a **Query** image and the right side contains potential **Matches**.
97
+ If "Calculate Sequence" was selected during the processing stage, the entire **Sequence** will be viewable on the Query side.
98
+ The pageview will display the images and associated metadata.
99
+ <br/>
100
+
101
+ _View Options_\
102
+ Adjustments can be made to the **Maximum Number of Matches** shown for each image (within a sequence) and to the maximum distance
103
+ threshold between the two images to qualify as a match. The **Cosine** or **L2** distance of the Match from the Query is displayed above the
104
+ match image. Select which distance metric to use in the dropdown. You must select **"Recalculate Matches"** if changes are made to either option
105
+ in order to display those changes.\
106
+ After matches are validated, you can **"Query by Individual"** to do quality control and ensure all images associated with
107
+ an individual are indeed valid.\
108
+ Images can be **Filtered** by Region, Survey, or Station to narrow the available matches shown.\
109
+ If **"Viewpoint"** was calculated at the processing step, you can filter both the **Query** and the **Match** images by Viewpoint.\
110
+ The **"View Data"** Button at the bottom brings you to the Media Validation pageview.
111
+ <br/>
112
+
113
+ _Image Options_\
114
+ You can adjust the **Brightness, Contrast** and **Sharpness** of each image, as well as **Zoom** using the mouse scroll wheel.\
115
+ The **"Reset"** button returns the image to its original form.\
116
+ The **"Edit Image"** option allows you to make changes to the metadata.\
117
+ The **"Open Image"** option opens the image in your default image viewer.\
118
+ The **"♥"** option marks the image with the "Favorite" tag.
119
+ <br/>
120
+
121
+ To confirm a match between the Query and the Match image, select the **"Match" button** in the middle, or press the 'M' or 'Space Key'.
122
+ Pressing Match again will undo the match, asking you to confirm first.\
123
+ You can navigate between Query Sequences and Matches by using the **"<<"** and **">>"** buttons, or by using the arrow keys.\
124
+ You can also toggle the **Viewpoint** by pressing 'V'.
125
+ <br/>
126
+
127
+ ### 5. Export
128
+ The database can be exported as a .csv file. Simply select '5. Export' and specify the file name and location.
129
+ <br/>
130
+
131
+ ---
132
+ ## Database Management
133
+ <br/>
134
+
135
+ ### Definitions
136
+ * Survey - An ecological study employing camera traps to investigate wildlife of a particular area.
137
+ * Region - A geographical region that may host one or more camera trap surveys.
138
+ * Station - Reference to a physical location containing one or camera traps.
139
+ * Species - The taxonomic and common names refering to a class of animal.
140
+ * Media - Image (and soon video) files obtained from camera traps.
141
+ * ROI - Regions of Interest within media files that contain animals.
142
+ * Individual - A particular, singular example of a given species, can be named/ID'd.
143
+ * Sequence ID - A unique number associated with a set of sequential images or frames in a video.
144
+ * External ID - A unique number used to reference MatchyPatchy output with other datamanagement tools.
145
+ * Viewpoint - The side of the body of the animl facing the camera, eg "Left", "Right", "Top"
146
+ * Comment - Notes or concerns about a particular media file
147
+ * Favorite - A tag marking an image as noteworthy.
148
+ <br/>
149
+
150
+ ### Manage Tables
151
+ **Survey, Station,** and **Species** tables can be managed independently.
152
+ <br/>
153
+
154
+ ### CSV Import
155
+ <br/>
156
+
157
+
158
+ ---
159
+ ## Configuration
160
+ <br/>
161
+
162
+ ### Available Models
163
+ Models currently available and compatible with MatchyPatchy:\
164
+ _Detector Models_:
165
+ - MegaDetector v5a
166
+ - MegaDetector v5b
167
+
168
+ _Re-ID Models_:
169
+ - MiewID v3
170
+ - MiewID v2
171
+
172
+ _Viewpoint Models_:
173
+ - SDZWA Viewpoint
174
+ <br/>
175
+
176
+ ### Link to New Database
177
+ Database files can be shared across multiple users of MatchyPatchy. To link to a new .db file,
178
+ <br/>
179
+
180
+ ### Clear Data
@@ -0,0 +1,42 @@
1
+ [project]
2
+ name = "matchypatchy"
3
+ dynamic = ["version"]
4
+ authors = [
5
+ { name="Kyra Swanson", email="tswanson@sdzwa.org" },
6
+ ]
7
+ description = "GUI tool for human validation of AI-powered animal re-identification"
8
+ readme = "README.md"
9
+ requires-python = ">=3.12"
10
+ dependencies = [
11
+ "animl-lite==3.3.2",
12
+ "chromadb>=1.3.4",
13
+ "pyqt6>=6.9.0",
14
+ ]
15
+
16
+ [project.urls]
17
+ Homepage = "https://github.com/onservationtechlab/matchypatchy"
18
+ Issues = "https://github.com/onservationtechlab/matchypatchy/issues"
19
+
20
+ [build-system]
21
+ requires = ["setuptools>=61.0"]
22
+ build-backend = "setuptools.build_meta"
23
+
24
+ [tool.setuptools.dynamic]
25
+ version = {attr = "matchypatchy.__version__"}
26
+
27
+ [tool.setuptools]
28
+ packages = ["matchypatchy"]
29
+ package-dir = {"" = "src"}
30
+
31
+ [tool.setuptools.package-data]
32
+ matchypatchy = ["assets/**/*", "assets/graphics/*"]
33
+
34
+ [tool.pytest.ini_options]
35
+ testpaths = ["tests"]
36
+ addopts = "-v"
37
+
38
+ [tool.pylint.master]
39
+ extension-pkg-whitelist = ["PyQt6"]
40
+
41
+ [tool.pylint.messages_control]
42
+ disable = ["no-name-in-module"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,105 @@
1
+ __version__ = "0.2.1rc1"
2
+
3
+ from matchypatchy import config
4
+ from matchypatchy import database
5
+ from matchypatchy import gui
6
+ from matchypatchy import logging_config
7
+ from matchypatchy import threads
8
+
9
+ from matchypatchy.config import (asset_path, mpConfig, resource_path,)
10
+ from matchypatchy.database import (EditObject, IMAGE_EXT, MatchyPatchyDB,
11
+ THUMBNAIL_NOTFOUND, THUMBNAIL_SIZE,
12
+ TZ_CONVERT_DICT, VIDEO_EXT,
13
+ check_missing_thumbnails, fetch_individual,
14
+ fetch_media, fetch_media_thumbnails,
15
+ fetch_regions, fetch_roi, fetch_roi_media,
16
+ fetch_roi_thumbnails,
17
+ fetch_station_names_from_id, fetch_stations,
18
+ fetch_surveys, get_frame, get_roi_bbox,
19
+ get_sequence, get_sha256,
20
+ individual_roi_dict, location, media,
21
+ media_count, mpdb, save_media_thumbnail,
22
+ save_roi_thumbnail, sequence_roi_dict,
23
+ setup, setup_chromadb, setup_database,
24
+ thumbnails,)
25
+ from matchypatchy.gui import (AlertPopup, ClickableSlider, ComboBoxDelegate,
26
+ ComboBoxSeparator, ConfigPopup, DisplayBase,
27
+ DisplayCompare, DisplayMedia, FilterBar,
28
+ FilterBox, HorizontalSeparator, ImageAdjustBar,
29
+ ImageWidget, ImportCSVPopup, ImportFolderPopup,
30
+ IndividualFillPopup, IndividualPopup,
31
+ MLDownloadPopup, MLOptionsPopup, MainWindow,
32
+ ManualQueryContainer, MediaEditPopup, MediaTable,
33
+ MediaWidget, MetadataPanel, NoHoverDelegate,
34
+ PairXPopup, QC_QueryContainer, QueryContainer,
35
+ READMEPopup, SequenceSelector, SliderWithLabel,
36
+ StandardButton, StationFillPopup, StationPopup,
37
+ SurveyFillPopup, SurveyPopup, TextEditWithSignal,
38
+ ThreePointSlider, UploadManagerPopup,
39
+ VerticalSeparator, VideoPlayerBar, VideoViewer,
40
+ VideoWidget, dialogs, display_base,
41
+ display_compare, display_media, gui_assets,
42
+ main_gui, manual_query, media_table, popup_alert,
43
+ popup_config, popup_import_csv,
44
+ popup_import_folder, popup_individual,
45
+ popup_media_edit, popup_ml, popup_pairx,
46
+ popup_readme, popup_station, popup_survey,
47
+ popup_uploads, qc_query, query, widget_filterbar,
48
+ widget_image_adjustment, widget_media, widgets,)
49
+ from matchypatchy.logging_config import (get_logger, setup_logger,)
50
+ from matchypatchy.threads import (AnimlThread, BasePathUpdateThread,
51
+ BuildManifestThread, CSVImportThread,
52
+ CSVMigrateThread, DownloadMLThread,
53
+ FavoriteMatchObject, FetchTableThread,
54
+ FolderImportThread, MEGADETECTORv1000_SIZE,
55
+ MatchEmbeddingThread, MatchObject,
56
+ ReIDThread, SequenceThread,
57
+ VerifyNewBaseDirsThread, animl_thread,
58
+ delete, get_path, import_thread,
59
+ is_valid_reid_model, load_model,
60
+ match_object, match_thread,
61
+ model_download_thread, reid_thread,
62
+ sequence_thread, table_thread,
63
+ update_model_yml,)
64
+
65
+ __all__ = ['AlertPopup', 'AnimlThread', 'BasePathUpdateThread',
66
+ 'BuildManifestThread', 'CSVImportThread', 'CSVMigrateThread',
67
+ 'ClickableSlider', 'ComboBoxDelegate', 'ComboBoxSeparator',
68
+ 'ConfigPopup', 'DisplayBase', 'DisplayCompare', 'DisplayMedia',
69
+ 'DownloadMLThread', 'EditObject', 'FavoriteMatchObject',
70
+ 'FetchTableThread', 'FilterBar', 'FilterBox', 'FolderImportThread',
71
+ 'HorizontalSeparator', 'IMAGE_EXT', 'ImageAdjustBar', 'ImageWidget',
72
+ 'ImportCSVPopup', 'ImportFolderPopup', 'IndividualFillPopup',
73
+ 'IndividualPopup', 'MEGADETECTORv1000_SIZE', 'MLDownloadPopup',
74
+ 'MLOptionsPopup', 'MainWindow', 'ManualQueryContainer',
75
+ 'MatchEmbeddingThread', 'MatchObject', 'MatchyPatchyDB',
76
+ 'MediaEditPopup', 'MediaTable', 'MediaWidget', 'MetadataPanel',
77
+ 'NoHoverDelegate', 'PairXPopup', 'QC_QueryContainer',
78
+ 'QueryContainer', 'READMEPopup', 'ReIDThread', 'SequenceSelector',
79
+ 'SequenceThread', 'SliderWithLabel', 'StandardButton',
80
+ 'StationFillPopup', 'StationPopup', 'SurveyFillPopup',
81
+ 'SurveyPopup', 'THUMBNAIL_NOTFOUND', 'THUMBNAIL_SIZE',
82
+ 'TZ_CONVERT_DICT', 'TextEditWithSignal', 'ThreePointSlider',
83
+ 'UploadManagerPopup', 'VIDEO_EXT', 'VerifyNewBaseDirsThread',
84
+ 'VerticalSeparator', 'VideoPlayerBar', 'VideoViewer', 'VideoWidget',
85
+ 'animl_thread', 'asset_path', 'check_missing_thumbnails', 'config',
86
+ 'database', 'delete', 'dialogs', 'display_base', 'display_compare',
87
+ 'display_media', 'fetch_individual', 'fetch_media',
88
+ 'fetch_media_thumbnails', 'fetch_regions', 'fetch_roi',
89
+ 'fetch_roi_media', 'fetch_roi_thumbnails',
90
+ 'fetch_station_names_from_id', 'fetch_stations', 'fetch_surveys',
91
+ 'get_frame', 'get_logger', 'get_path', 'get_roi_bbox',
92
+ 'get_sequence', 'get_sha256', 'gui', 'gui_assets', 'import_thread',
93
+ 'individual_roi_dict', 'is_valid_reid_model', 'load_model',
94
+ 'location', 'logging_config', 'main_gui', 'manual_query',
95
+ 'match_object', 'match_thread', 'media', 'media_count',
96
+ 'media_table', 'model_download_thread', 'mpConfig', 'mpdb',
97
+ 'popup_alert', 'popup_config', 'popup_import_csv',
98
+ 'popup_import_folder', 'popup_individual', 'popup_media_edit',
99
+ 'popup_ml', 'popup_pairx', 'popup_readme', 'popup_station',
100
+ 'popup_survey', 'popup_uploads', 'qc_query', 'query', 'reid_thread',
101
+ 'resource_path', 'save_media_thumbnail', 'save_roi_thumbnail',
102
+ 'sequence_roi_dict', 'sequence_thread', 'setup', 'setup_chromadb',
103
+ 'setup_database', 'setup_logger', 'table_thread', 'threads',
104
+ 'thumbnails', 'update_model_yml', 'widget_filterbar',
105
+ 'widget_image_adjustment', 'widget_media', 'widgets']
@@ -0,0 +1,78 @@
1
+ '''
2
+ Main entry point for MatchyPatchy application
3
+ '''
4
+
5
+ import os
6
+ import sys
7
+ import time
8
+ from pathlib import Path
9
+ from PyQt6.QtWidgets import QApplication
10
+
11
+ from matchypatchy.logging_config import setup_logger, get_logger
12
+ from matchypatchy.gui import MainWindow
13
+
14
+
15
+ def setup_cuda_path():
16
+ """Dynamically find and add NVIDIA CUDA/cuDNN libraries to PATH"""
17
+ try:
18
+ # Try to find nvidia packages in site-packages
19
+ import site
20
+ site_packages = site.getsitepackages()
21
+
22
+ if isinstance(site_packages, str):
23
+ site_packages = [site_packages]
24
+
25
+ for site_dir in site_packages:
26
+ nvidia_lib_path = Path(site_dir) / "nvidia"
27
+
28
+ if nvidia_lib_path.exists():
29
+ dll_folders = [
30
+ nvidia_lib_path / "cuda_runtime" / "bin",
31
+ nvidia_lib_path / "cuda_nvrtc" / "bin",
32
+ nvidia_lib_path / "cublas" / "bin",
33
+ nvidia_lib_path / "cudnn" / "bin",
34
+ ]
35
+
36
+ for folder in dll_folders:
37
+ if folder.exists():
38
+ os.environ['PATH'] = str(folder) + os.pathsep + os.environ['PATH']
39
+
40
+ return True
41
+ except Exception as e:
42
+ print(f"Warning: Could not setup CUDA path: {e}")
43
+
44
+ return False
45
+
46
+
47
+ if __name__ == "__main__":
48
+ start_time = time.time()
49
+
50
+ # Setup application-wide logging
51
+ root_logger = setup_logger()
52
+ logger = get_logger(__name__)
53
+ logger.info("=" * 70)
54
+ logger.info("MatchyPatchy starting up...")
55
+
56
+ exit_code = 1 # Default to error; overwritten on successful run
57
+
58
+ try:
59
+ setup_cuda_path()
60
+ app = QApplication(sys.argv)
61
+ window = MainWindow(logger)
62
+ logger.info("Main window initialized")
63
+ window.show()
64
+
65
+ startup_time = time.time() - start_time
66
+ logger.info(f"Startup took {startup_time:.2f} seconds")
67
+ logger.info("-" * 70)
68
+
69
+ exit_code = app.exec()
70
+
71
+ except Exception as e:
72
+ logger.error(f"Fatal error during startup: {e}", exc_info=True)
73
+ exit_code = 1
74
+
75
+ finally:
76
+ logger.info("MatchyPatchy shutting down")
77
+ logger.info("=" * 70)
78
+ sys.exit(exit_code)
@@ -0,0 +1,25 @@
1
+ MODELS:
2
+ "MegaDetector":
3
+ - ["md_v1000.0.0-sorrel.onnx"]
4
+ - ["https://sandiegozoo.box.com/shared/static/7z9xagk8zweu6op3dgdk386jf9ayl2gt.onnx"]
5
+ "miewid_v3":
6
+ - ["miewid_v3.onnx", "miewid_v3.onnx.data"]
7
+ - ["https://sandiegozoo.box.com/shared/static/ppm0odjgscvpj9lf5ax86p3fqu5vraxw.onnx",
8
+ "https://sandiegozoo.box.com/shared/static/xi1dijx35ta2tqtu2sa28bd09ve9li6f.data"]
9
+ "Jaguar Viewpoint":
10
+ - ["sdzwa_jaguar_viewpoint.onnx", "sdzwa_jaguar_viewpoint.onnx.data"]
11
+ - ["https://sandiegozoo.box.com/shared/static/nkuku5aeicg9hugo0hogdjxg667xodlb.onnx",
12
+ "https://sandiegozoo.box.com/shared/static/3563emet6b6tubtgtqce8144dlq3z8y5.data"]
13
+
14
+
15
+ DETECTOR_MODELS:
16
+ - "MegaDetector"
17
+
18
+ REID_MODELS: ["miewid_v3"]
19
+ VIEWPOINT_MODELS: ["Jaguar Viewpoint"]
20
+
21
+ VIEWPOINTS:
22
+ 'Any': "Any"
23
+ 'None': "None"
24
+ '0': "Right"
25
+ '1': "Left"