Refactor: Integrate backend API and normalize data
This commit integrates the backend API for fetching and updating report data. It also includes a normalization function to handle data consistency between the API and local storage. Co-authored-by: anthonymuncher <anthonymuncher@gmail.com>
This commit is contained in:
33
backend/test/Machine_Learning/broken_street_light.py
Normal file
33
backend/test/Machine_Learning/broken_street_light.py
Normal file
@@ -0,0 +1,33 @@
|
||||
# from bing_image_downloader import downloader
|
||||
|
||||
# downloader.download(
|
||||
# "broken streetlight",
|
||||
# limit=100,
|
||||
# output_dir='dataset_downloads',
|
||||
# adult_filter_off=True,
|
||||
# force_replace=False,
|
||||
# timeout=60
|
||||
# )
|
||||
|
||||
from bing_image_downloader import downloader
|
||||
from pathlib import Path
|
||||
|
||||
# ---------- CONFIG ----------
|
||||
CLASS_NAME = "drainage"
|
||||
LIMIT = 200 # number of images to download
|
||||
OUTPUT_DIR = Path("dataset_downloads") # folder to store downloaded images
|
||||
|
||||
# Ensure the output directory exists
|
||||
OUTPUT_DIR.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# ---------- DOWNLOAD IMAGES ----------
|
||||
downloader.download(
|
||||
CLASS_NAME,
|
||||
limit=LIMIT,
|
||||
output_dir=str(OUTPUT_DIR),
|
||||
adult_filter_off=True, # keep it safe
|
||||
force_replace=False, # don't overwrite if already downloaded
|
||||
timeout=60 # seconds per request
|
||||
)
|
||||
|
||||
print(f"✅ Downloaded {LIMIT} images for class '{CLASS_NAME}' in '{OUTPUT_DIR}'")
|
||||
Reference in New Issue
Block a user