-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconstants.py
More file actions
217 lines (189 loc) · 7.31 KB
/
constants.py
File metadata and controls
217 lines (189 loc) · 7.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# Bumblebee Image Evaluation Configuration
# Based on 16 Bombus species from GBIF_MA_BUMBLEBEES dataset
# ============================================
# MODE CONFIGURATION
# ============================================
import os
MODE = os.environ.get("EVAL_MODE", "calibration") # "calibration" or "full"
if MODE == "calibration":
IMAGES_PER_USER = 15 # 5 per species, all researchers see same set (IRR)
TOTAL_IMAGES = 15
MAX_USERS_PER_SUBSET = 3 # all 3 researchers share subset 0
ACTIVE_DB = "sqlite:///bumblebee_evaluation_calibration.db"
else: # full
IMAGES_PER_USER = 50 # 150 images / 3 subsets = 50 per researcher
TOTAL_IMAGES = 150
MAX_USERS_PER_SUBSET = 3 # allow multiple researchers per subset
ACTIVE_DB = "sqlite:///bumblebee_evaluation_full.db"
# Species with synthetic images (expert validation set)
SPECIES_WITH_SYNTHETIC = [
"Bombus_ashtoni", # 50 images
"Bombus_sandersoni", # 50 images
"Bombus_flavidus" # 50 images
]
# Asset paths
METADATA_JSON = f"assets/bumblebee_images_metadata_{MODE}.json"
STATIC_IMAGES_DIR = "static/bumblebees"
STATIC_REFERENCES_DIR = "static/references"
# Workflow configuration
USE_SINGLE_PAGE_WORKFLOW = True # Two-stage single-page design
USE_TAXONOMY_DROPDOWNS = True # Dropdowns for Family/Genus
# ============================================
# REFERENCE IMAGES CONFIGURATION
# ============================================
SHOW_REFERENCE_IMAGES = True # Show after Stage 1 reveal
MAX_REFERENCE_IMAGES = 5 # Maximum reference images to display
REFERENCE_IMAGE_LAYOUT = "grid" # "grid" or "carousel"
# ============================================
# QUESTION 1: Blind Species ID with Dropdowns
# ============================================
# All 16 bumblebee species from GBIF_MA_BUMBLEBEES + "No match"
BUMBLEBEE_SPECIES = [
"Bombus affinis",
"Bombus ashtoni",
"Bombus bimaculatus",
"Bombus borealis",
"Bombus citrinus",
"Bombus fervidus",
"Bombus flavidus",
"Bombus griseocollis",
"Bombus impatiens",
"Bombus pensylvanicus",
"Bombus perplexus",
"Bombus rufocinctus",
"Bombus sandersoni",
"Bombus ternarius",
"Bombus terricola",
"Bombus vagans",
"No match" # Expert cannot identify to any known species
]
# Taxonomy options for dropdowns
TAXONOMY_OPTIONS = {
"families": [
"Apidae",
"No match",
],
"genera_by_family": {
"Apidae": [
"Bombus",
"No match",
]
},
"species_by_genus": {
"Bombus": [
"Bombus affinis",
"Bombus ashtoni",
"Bombus bimaculatus",
"Bombus borealis",
"Bombus citrinus",
"Bombus fervidus",
"Bombus flavidus",
"Bombus griseocollis",
"Bombus impatiens",
"Bombus pensylvanicus",
"Bombus perplexus",
"Bombus rufocinctus",
"Bombus sandersoni",
"Bombus ternarius",
"Bombus terricola",
"Bombus vagans",
"No match"
]
}
}
# ============================================
# QUESTION 2: Morphological Fidelity (5 FEATURES)
# ============================================
MORPHOLOGICAL_FEATURES = [
("legs_appendages", "Legs/Appendages"),
("wing_venation_texture", "Wing Venation/Texture"),
("head_antennae", "Head/Antennae"),
("abdomen_banding", "Abdomen Banding"), # Critical for Bombus ID
("thorax_coloration", "Thorax Coloration") # Critical for Bombus ID
]
# ============================================
# QUESTION 2B: Blind Caste Identification
# ============================================
# Per-species caste options (cuckoo vs eusocial have different castes)
CASTE_OPTIONS_BY_SPECIES = {
"Bombus ashtoni": [("female", "Female"), ("male", "Male"), ("uncertain", "Uncertain")],
"Bombus flavidus": [("female", "Female"), ("male", "Male"), ("uncertain", "Uncertain")],
"Bombus sandersoni": [("worker", "Worker"), ("queen", "Queen"), ("male", "Male"), ("uncertain", "Uncertain")],
}
# Fallback for unknown species
CASTE_OPTIONS_DEFAULT = [
("worker", "Worker"),
("queen", "Queen"),
("male", "Male"),
("female", "Female"),
("uncertain", "Uncertain"),
]
# ============================================
# QUESTION 3: Diagnostic Completeness (SIMPLIFIED)
# ============================================
DIAGNOSTIC_LEVELS = [
("none", "Not identifiable (unusable image)"),
("family", "Family level only (Apidae)"),
("genus", "Genus level (Bombus)"),
("species", "Species level (full identification)")
]
# ============================================
# QUESTION 4: Failure Modes (MULTI-SELECT)
# Split into two categories:
# A) Species Fidelity/Correctness
# B) Image Quality
# ============================================
FAILURE_MODE_SPECIES = [
("species_no_failure", "No Failure"),
("extra_missing_limbs", "Extra/Missing Limbs"),
("wrong_coloration", "Wrong Coloration/Pattern"),
("impossible_geometry", "Impossible Geometry/Unnatural Pose"),
("wrong_scale", "Unrealistic Scale Relative to Environment"),
("species_other", "Other"),
]
FAILURE_MODE_QUALITY = [
("quality_no_failure", "No Failure"),
("blurry_artifacts", "Blurry/Visual Artifacts"),
("background_bleed", "Background Bleed/Contamination"),
("flower_unrealistic", "Unrealistic Flower Geometry"),
("repetitive_pattern", "Repetitive/Cloned Patterns"),
("quality_other", "Other"),
]
# Combined for backward compatibility
FAILURE_MODE_OPTIONS = FAILURE_MODE_SPECIES + FAILURE_MODE_QUALITY
# ============================================
# PROLIFIC INTEGRATION
# ============================================
COMPLETION_CODE = "BUMBLEBEE_EVAL_2025" # Update for your study
# Omit completed subsets (update as you collect data)
OMIT_SUBSETS = []
OMIT_IMAGE_IDS = [] # Specific images to exclude
# ============================================
# SPECIES METADATA (Optional - for display)
# ============================================
SPECIES_COMMON_NAMES = {
"Bombus affinis": "Rusty Patched Bumble Bee",
"Bombus ashtoni": "Ashton Cuckoo Bumble Bee",
"Bombus bimaculatus": "Two-spotted Bumble Bee",
"Bombus borealis": "Northern Amber Bumble Bee",
"Bombus citrinus": "Lemon Cuckoo Bumble Bee",
"Bombus fervidus": "Yellow Bumble Bee",
"Bombus flavidus": "Fernald's Cuckoo Bumble Bee",
"Bombus griseocollis": "Brown-belted Bumble Bee",
"Bombus impatiens": "Common Eastern Bumble Bee",
"Bombus pensylvanicus": "American Bumble Bee",
"Bombus perplexus": "Confusing Bumble Bee",
"Bombus rufocinctus": "Red-belted Bumble Bee",
"Bombus sandersoni": "Sanderson's Bumble Bee",
"Bombus ternarius": "Tri-colored Bumble Bee",
"Bombus terricola": "Yellow-banded Bumble Bee",
"Bombus vagans": "Half-black Bumble Bee"
}
# Critical morphological features per species (for reference)
SPECIES_KEY_FEATURES = {
"Bombus impatiens": "Yellow and black banding, fuzzy thorax, very common",
"Bombus sandersoni": "Smaller, T1-2 yellow, T3-5 black, some black between wing bases",
"Bombus ashtoni": "Hair on head almost entirely black, white on abdomen end",
"Bombus flavidus": "Cuckoo bee, variable coloration, often yellowish pile on thorax",
"Bombus affinis": "Rusty patch on abdomen, critically endangered",
}