This commit is contained in:
2026-06-06 17:38:26 -04:00
parent 96de91e86c
commit cc7b2a593a
4 changed files with 573 additions and 8 deletions

View File

@@ -591,7 +591,9 @@ function countImagesInDir(classDir: string): number {
function reconcileClassCount(classDir: string, progressCount: number): number {
const fileCount = countImagesInDir(classDir);
if (fileCount < progressCount) {
console.log(` ↻ File count (${fileCount}) < progress count (${progressCount}) — reconciling`);
console.log(
` ↻ File count (${fileCount}) < progress count (${progressCount}) — reconciling`,
);
return fileCount;
}
return progressCount;
@@ -776,6 +778,13 @@ async function main() {
mkdirSync(DATASET_DIR, { recursive: true });
const progress = loadProgress();
// If all phases complete, exit early
if (progress.phase === 3) {
console.log(" ✓ All phases already complete. Delete .progress.json to re-run.");
await closeDb();
return;
}
const startTime = Date.now();
// ── Phase 1: Core set ──────────────────────────────────────────────────
@@ -786,7 +795,9 @@ async function main() {
const coreStart = progress.phase === 0 ? progress.phaseIndex : 0;
if (coreStart > 0) {
console.log(` Resuming from disease #${coreStart + 1} (${((coreStart / coreDiseases.length) * 100).toFixed(0)}% done)`);
console.log(
` Resuming from disease #${coreStart + 1} (${((coreStart / coreDiseases.length) * 100).toFixed(0)}% done)`,
);
}
for (let i = coreStart; i < coreDiseases.length; i++) {
@@ -814,7 +825,9 @@ async function main() {
const fullStart = progress.phase === 1 ? progress.phaseIndex : 0;
if (fullStart > 0) {
console.log(` Resuming from disease #${fullStart + 1} (${((fullStart / fullDiseases.length) * 100).toFixed(0)}% done)`);
console.log(
` Resuming from disease #${fullStart + 1} (${((fullStart / fullDiseases.length) * 100).toFixed(0)}% done)`,
);
}
for (let i = fullStart; i < fullDiseases.length; i++) {