-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcapture_commands.sh
More file actions
257 lines (176 loc) · 14.3 KB
/
Copy pathcapture_commands.sh
File metadata and controls
257 lines (176 loc) · 14.3 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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
#!/usr/bin/env bash
# Command cookbook for control.py.
# This file is intentionally just a commented command list. Copy a command,
# edit class_id / output-dir / position / params, then run it from the repo root.
#
# New collection pipeline:
# 1. Physically set the light position.
# 2. Run control.py with --light-position POSITION.
# 3. Enter class IDs interactively; after each input, capture starts after
# --start-delay-seconds seconds.
# 4. Stop the script, move the light, rerun with a new --light-position.
#
# Mapping layout:
# images are stored as <output-dir>/lXXX/cXXX/sYYY/vXXX/pXXX.jpg
# <output-dir>/maps/parameters.json cumulative global parameter map
# samples[] includes per-object timing: started_at, completed_at,
# object_elapsed_seconds, capture_elapsed_seconds
# params[] includes p000 for auto exposure when enabled
# <output-dir>/maps/captures.jsonl cumulative per-image records
echo "This is a command cookbook. Copy a commented command from this file and run it manually."
echo "No capture command was executed."
exit 0
# =========================
# Command During Test
# =========================
# Reflect light, single view, iterative class input, intensity 10, p000 auto exposure.
# Prints per-object timing at the end of each sample.
# sonycam control.py --capture-mode append --output-dir dataset --light-position reflect --light-intensities 10 --fast-shutter --skip-turntable --views 1
# Face light can use a different intensity from normal/reflect light.
# Append another physical light position to an existing dataset. Prompts for class_id repeatedly.
# sonycam control.py --capture-mode append --output-dir dataset --light-position side --fast-shutter
# Append one class only for the current physical light position.
# sonycam control.py --capture-mode append --class-id 1 --output-dir dataset --light-position front --fast-shutter
# Camera + light only for the current light position, skipping turntable.
# sonycam control.py --capture-mode append --class-id 1 --output-dir dataset --light-position front --fast-shutter --skip-turntable
# delete records
# check only
# python capture_util/remove_records.py --output-dir dataset --class-id 1 --sample-id 3
#apply
# sudo
# =========================
# Help / Sanity Checks
# =========================
# Show all control.py arguments.
# python control.py --help
# Same help command through the Sony camera launcher.
# sonycam control.py --help
# Check Python syntax after editing control.py.
# python -m py_compile control.py
# Pretty-print the current global parameter map.
# python -m json.tool dataset/maps/parameters.json
# Print the first few per-image JSONL records.
# python -c 'from itertools import islice; from pathlib import Path; print("".join(islice(Path("dataset/maps/captures.jsonl").open(), 5)), end="")'
# =========================
# Manual SAM Crop Pipeline
# =========================
# Step 1: Generate SAM candidate masks from l001/<class>/<sample>/<view>/p000.jpg.
# /mnt/hdd1/yuyang/install/conda_envs/adapcam/bin/python -u scripts/crop_test_ver3_by_p000_sam.py --mode prepare-candidates --sam-checkpoint models/sam_vit_b_01ec64.pth --device auto --overwrite
# Step 2: Copy the selection template, then edit candidate_ids by inspecting dataset/test_ver3_cropped/candidate_qc/*.jpg.
# cp dataset/test_ver3_cropped/manual_selections.template.json dataset/test_ver3_cropped/manual_selections.json
# Step 3: Dry-run the manual selections and inspect dataset/test_ver3_cropped/crop_qc/*.jpg.
# /mnt/hdd1/yuyang/install/conda_envs/adapcam/bin/python -u scripts/crop_test_ver3_by_p000_sam.py --mode crop --sam-checkpoint models/sam_vit_b_01ec64.pth --manual-selections dataset/test_ver3_cropped/manual_selections.json --dry-run --overwrite
# Step 4: Write the cropped dataset after QC looks right.
# /mnt/hdd1/yuyang/install/conda_envs/adapcam/bin/python -u scripts/crop_test_ver3_by_p000_sam.py --mode crop --sam-checkpoint models/sam_vit_b_01ec64.pth --manual-selections dataset/test_ver3_cropped/manual_selections.json --overwrite
# =========================
# Downstream Evaluation / Analysis
# =========================
# Optional: create/edit class labels before the first downstream run.
# cp dataset/test_ver3_cropped/class_labels.template.json dataset/test_ver3_cropped/class_labels.json
# Run ResNet50 + OpenCLIP top-1 downstream evaluation. Writes downstream_eval/image_results.jsonl.
# /mnt/hdd1/yuyang/install/conda_envs/adapcam/bin/python -u scripts/evaluate_downstream.py --dataset-root dataset/test_ver3_cropped --class-labels dataset/test_ver3_cropped/class_labels.json --models resnet50,openclip --device auto
# Aggregate correct count / accuracy by parameter and by object.
# /mnt/hdd1/yuyang/install/conda_envs/adapcam/bin/python -u scripts/analysis/param_correct_counts.py --results dataset/test_ver3_cropped/downstream_eval/image_results.jsonl
# Measure overlap of successful parameters across lighting pairs.
# /mnt/hdd1/yuyang/install/conda_envs/adapcam/bin/python -u scripts/analysis/lighting_overlap.py --results dataset/test_ver3_cropped/downstream_eval/image_results.jsonl
# AE baseline: write one CSV with by-lighting rows and overall rows for param_id=0 / auto exposure.
# /mnt/hdd1/yuyang/install/conda_envs/adapcam/bin/python -u scripts/analysis/ae_baseline.py --results dataset/test_ver3_cropped/downstream_eval/image_results.jsonl --output-file dataset/test_ver3_cropped/analysis/ae_baseline.csv
# Optional variants: exclude AE param from parameter count and lighting overlap analyses.
# /mnt/hdd1/yuyang/install/conda_envs/adapcam/bin/python -u scripts/analysis/param_correct_counts.py --results dataset/test_ver3_cropped/downstream_eval/image_results.jsonl --exclude-auto-param
# /mnt/hdd1/yuyang/install/conda_envs/adapcam/bin/python -u scripts/analysis/lighting_overlap.py --results dataset/test_ver3_cropped/downstream_eval/image_results.jsonl --exclude-auto-param
# =========================
# Dataset Cleanup
# =========================
# Delete old pre-light-top-layout folders. This requires sudo because some folders are root-owned.
# sudo rm -rf dataset/c000 dataset/c001 dataset/c002 dataset/c003
# Reset maps after deleting all old-layout data.
# python -c 'import json, time; from pathlib import Path; p=Path("dataset/maps/parameters.json"); d=json.loads(p.read_text()); d["classes"]=[]; d["samples"]=[]; d["lights"]=[]; d["views"]=[]; d["params"]=[]; d["updated_at"]=time.strftime("%Y-%m-%dT%H:%M:%S%z"); p.write_text(json.dumps(d, indent=2, sort_keys=True)+"\n"); Path("dataset/maps/captures.jsonl").write_text("")'
# Preview removing one bad sample and its map records.
# python capture_util/remove_records.py --output-dir dataset --class-id 1 --sample-id 2
# Actually remove one bad sample and its map records.
# python capture_util/remove_records.py --output-dir dataset --class-id 1 --sample-id 2 --apply
# Remove an entire class.
# python capture_util/remove_records.py --output-dir dataset --class-id 2 --apply
# Remove one light id across the dataset.
# python capture_util/remove_records.py --output-dir dataset --light-id 1 --apply
# Remove one physical lighting condition across the dataset.
# python capture_util/remove_records.py --output-dir dataset --light-position reflect --intensity 10 --cct 5600 --apply
# Remove one view id across the dataset.
# python capture_util/remove_records.py --output-dir dataset --view-id 1 --apply
# Remove only p000 auto exposure images/records.
# python capture_util/remove_records.py --output-dir dataset --param-id 0 --apply
# =========================
# Auto-exposure-only Recapture
# =========================
# Safest way to recapture the existing 15 AE images: write them to a separate
# dataset so the original images and maps stay untouched. For each command,
# enter these five objects at the prompt, then enter q:
# 0, 1 (first object), 1 (second object), 2, 3
# Keep the two class-1 objects in the same order for every lighting condition.
# 1/3: reflect lighting, intensity 10. The new output directory must be empty/nonexistent.
# sonycam control.py --capture-mode fresh --output-dir dataset/ae_recapture_20260721 --light-position reflect --light-intensities 10 --views 1 --auto-exposure-only --skip-turntable --fast-shutter
# 2/3: normal lighting, intensity 300.
# sonycam control.py --capture-mode append --output-dir dataset/ae_recapture_20260721 --light-position normal --light-intensities 300 --views 1 --auto-exposure-only --skip-turntable --fast-shutter
# 3/3: face lighting, intensity 1000.
# sonycam control.py --capture-mode append --output-dir dataset/ae_recapture_20260721 --light-position face --light-intensities 1000 --views 1 --auto-exposure-only --skip-turntable --fast-shutter
# =========================
# Fresh Dataset
# =========================
# Fresh dry-run into a new empty temp-like directory.
# python control.py --dry-run --capture-mode fresh --class-id 1 --output-dir /private/tmp/testbed-fresh-dry-run --light-position front --light-intensities 10,20 --views 1 --apertures 2.8 --isos 100 --shutters 60 --start-delay-seconds 0 --skip-turntable
# Fresh real capture, one quick image per intensity for one class.
# sonycam control.py --capture-mode fresh --class-id 1 --output-dir dataset_fresh_quick --light-position front --light-intensities 10,20 --views 1 --apertures 2.8 --isos 100 --shutters 60 --start-delay-seconds 0 --fast-shutter
# =========================
# Append Dataset
# =========================
# Append dry-run: same position, two intensities.
# python control.py --dry-run --capture-mode append --class-id 1 --output-dir dataset --light-position front --light-intensities 10,20 --views 1 --apertures 2.8 --isos 100 --shutters 60 --start-delay-seconds 0 --skip-turntable
# Append using the default full intensity sweep for one position.
# sonycam control.py --capture-mode append --class-id 1 --output-dir dataset --light-position front --fast-shutter
# Append a new physical light position. The map will assign different light_id values.
# sonycam control.py --capture-mode append --class-id 1 --output-dir dataset --light-position side --fast-shutter
# =========================
# Smaller Capture Plans
# =========================
# One quick real capture per light intensity before a long run.
# sonycam control.py --capture-mode append --class-id 1 --output-dir dataset --light-position front --views 1 --apertures 2.8 --isos 100 --shutters 60 --start-delay-seconds 0 --fast-shutter
# One view only, with the full camera parameter sweep.
# sonycam control.py --capture-mode append --class-id 1 --output-dir dataset --light-position front --views 1 --fast-shutter
# One view only, with no p000 auto-exposure image.
# sonycam control.py --capture-mode append --class-id 1 --output-dir dataset --light-position front --views 1 --skip-auto-exposure --fast-shutter
# Four views, one camera parameter.
# sonycam control.py --capture-mode append --class-id 1 --output-dir dataset --light-position front --views 4 --view-step 90 --apertures 2.8 --isos 100 --shutters 60 --fast-shutter
# Custom camera parameter sweep.
# sonycam control.py --capture-mode append --class-id 1 --output-dir dataset --light-position front --apertures 2.8,4,8 --isos 100,800,3200 --shutters 60,250 --fast-shutter
# Custom light intensities for current position.
# sonycam control.py --capture-mode append --class-id 1 --output-dir dataset --light-position front --light-intensities 100,300,700 --fast-shutter
# Host + camera storage: save images to both computer and camera card.
# sonycam control.py --capture-mode append --class-id 1 --output-dir dataset --light-position front --save-media host-and-camera --fast-shutter
# =========================
# Per-object Timing Checks
# =========================
# Minimal dry-run timing check: writes samples[].object_elapsed_seconds in parameters.json.
# python control.py --dry-run --capture-mode fresh --class-id 1 --output-dir /private/tmp/testbed-object-timing-dry-run --light-position front --light-intensities 100 --views 1 --apertures 2.8 --isos 100 --shutters 60 --start-delay-seconds 0 --skip-turntable
# Minimal real hardware timing check with p000 auto exposure and one manual parameter.
# sonycam control.py --capture-mode append --class-id 1 --output-dir /private/tmp/testbed-object-timing-hardware --light-position front --light-intensities 100 --views 1 --apertures 2.8 --isos 100 --shutters 60 --start-delay-seconds 0 --settle-seconds 0.2 --fast-shutter
# Real light + camera timing, skip turntable.
# sonycam control.py --capture-mode append --class-id 1 --output-dir /private/tmp/testbed-object-timing-light-camera --light-position front --light-intensities 0,100,500 --views 1 --apertures 2.8 --isos 100 --shutters 60 --start-delay-seconds 0 --settle-seconds 0.2 --skip-turntable --fast-shutter
# Real camera timing only, skip light and turntable.
# sonycam control.py --capture-mode append --class-id 1 --output-dir /private/tmp/testbed-object-timing-camera-only --light-position front --light-intensities 0 --views 1 --apertures 2.8 --isos 100,800 --shutters 60 --start-delay-seconds 0 --skip-light --skip-turntable --fast-shutter
# =========================
# Hardware / Connection Options
# =========================
# Explicit turntable serial port.
# sonycam control.py --capture-mode append --class-id 1 --output-dir dataset --light-position front --turntable-port /dev/cu.usbmodem1101 --fast-shutter
# Custom turntable speed and settle time.
# sonycam control.py --capture-mode append --class-id 1 --output-dir dataset --light-position front --turntable-speed 15 --settle-seconds 1.0 --fast-shutter
# Custom Amaran websocket URL.
# sonycam control.py --capture-mode append --class-id 1 --output-dir dataset --light-position front --light-ws-url ws://127.0.0.1:12345 --fast-shutter
# Custom Amaran client id.
# sonycam control.py --capture-mode append --class-id 1 --output-dir dataset --light-position front --light-client-id 1 --fast-shutter
# Custom Amaran API secret key.
# sonycam control.py --capture-mode append --class-id 1 --output-dir dataset --light-position front --light-api-secret-key YOUR_SECRET_KEY --fast-shutter
# Increase capture timeout if camera transfer is slow.
# sonycam control.py --capture-mode append --class-id 1 --output-dir dataset --light-position front --capture-timeout 60 --fast-shutter
# Remove the initial countdown delay.
# sonycam control.py --capture-mode append --class-id 1 --output-dir dataset --light-position front --start-delay-seconds 0 --fast-shutter