feat: completely remove IMG_20260701_134635 and IMG_20260701_134636 from dataset and update report
This commit is contained in:
1 parent
2a644cfa6d
commit
a211593f2c
4 files changed
+52
-76
No files matched your search
@@ -0,0 +1,52 @@
|
||||
import os
|
||||
import json
|
||||
|
||||
def main():
|
||||
to_delete = [
|
||||
"IMG_20260701_134635.jpg",
|
||||
"IMG_20260701_134636.jpg"
|
||||
]
|
||||
|
||||
base_dir = "backend"
|
||||
if not os.path.exists(base_dir):
|
||||
base_dir = "."
|
||||
|
||||
uploads_dir = os.path.join(base_dir, "uploads")
|
||||
public_dir = os.path.join(base_dir, "pfm-web-app/public")
|
||||
|
||||
for filename in to_delete:
|
||||
# Delete manual label json
|
||||
ml_path = os.path.join(uploads_dir, f"manual_label_{filename}.json")
|
||||
if os.path.exists(ml_path):
|
||||
os.remove(ml_path)
|
||||
print(f"Deleted: {ml_path}")
|
||||
|
||||
# Delete public image
|
||||
img_public_path = os.path.join(public_dir, "test-images", filename)
|
||||
if os.path.exists(img_public_path):
|
||||
os.remove(img_public_path)
|
||||
print(f"Deleted: {img_public_path}")
|
||||
|
||||
# Filter test_images_results.jsonl
|
||||
jsonl_path = os.path.join(uploads_dir, "test_images_results.jsonl")
|
||||
if os.path.exists(jsonl_path):
|
||||
remaining_lines = []
|
||||
with open(jsonl_path, "r", encoding="utf-8") as f:
|
||||
for line in f:
|
||||
if not line.strip():
|
||||
continue
|
||||
try:
|
||||
data = json.loads(line)
|
||||
fn = data.get("filename")
|
||||
if fn not in to_delete:
|
||||
remaining_lines.append(line)
|
||||
except Exception as e:
|
||||
print(f"Error parsing line: {e}")
|
||||
remaining_lines.append(line)
|
||||
|
||||
with open(jsonl_path, "w", encoding="utf-8") as f:
|
||||
f.writelines(remaining_lines)
|
||||
print(f"Filtered results JSONL. Remaining entries: {len(remaining_lines)}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in new issue
Block a user