The dataset viewer is not available because its heuristics could not detect any supported data files. You can try uploading some data files, or configuring the data files location manually.
LPR crops: multi-country license plate crops
Cropped license plate images with plate text, from 91 countries, stored as Arrow IPC shards with one folder per country.
| Rows | 1,754,235 (1,683,308 after the recommended filters, see below) |
| Countries | 91 (ISO-2, from the country=XX/ folder name) |
| Files | 303 Arrow shards, about 36 GB |
| Splits (after filters) | train 1,141,747 · val 212,755 · test 328,806, given in the split column |
| Largest countries | CN 733k · BY 178k · AE 54k · KG 39k · AM 28k · KZ 28k · BR 25k |
Layout
country=AD/autoria_eu-part-0.arrow
country=BY/platesmania-BY-part-0.arrow
...
The country is not stored as a column. Take it from the folder name.
Main columns
| Column | Type | Notes |
|---|---|---|
crop_bytes |
binary | Plate crop, JPEG (crop_format) |
render_bytes |
binary | Optional rectified rendering, PNG (render_format) |
plate_text |
string | Label |
original_text |
string | Label before normalisation |
layout |
string | one_line / two_line / null |
split |
string | train / val / test |
source_dataset, license |
string | Where the row came from and its license (see Licensing) |
label_pairing |
string | bound / unverified / ambiguous |
exclusion, crop_missing |
string | Non-null means the row should be dropped |
several_plates |
bool | The frame contains more than one plate |
plate_quad, char_boxes, crop_xyxy, frame_size, tilt_deg, … |
Geometry metadata |
Recommended filters: non-empty plate_text; exclusion is null; crop_missing is null; several_plates is not true.
Download
pip install -U huggingface_hub
# all countries
hf download quangduc/lpr --repo-type dataset --local-dir data/crops
# selected countries
hf download quangduc/lpr --repo-type dataset --local-dir data/crops --include "country=BY/*" "country=AD/*"
Download script
Save as download_lpr.py:
#!/usr/bin/env python
"""Download quangduc/lpr (Arrow shards, one folder per country).
python download_lpr.py --list # countries and sizes
python download_lpr.py --out data/crops --countries BY AD # subset
python download_lpr.py --out data/crops # everything (~36 GB)
"""
import argparse
import re
from collections import defaultdict
from huggingface_hub import HfApi, snapshot_download
REPO_ID = "quangduc/lpr"
def list_countries(repo, revision):
sizes, counts = defaultdict(int), defaultdict(int)
for f in HfApi().list_repo_tree(repo, repo_type="dataset", revision=revision, recursive=True):
m = re.match(r"country=([A-Z]{2})/.+\.arrow$", f.path)
if m and getattr(f, "size", None) is not None:
sizes[m.group(1)] += f.size
counts[m.group(1)] += 1
for c in sorted(sizes, key=lambda k: -sizes[k]):
print(f"{c} {counts[c]:3d} files {sizes[c] / 2**30:7.2f} GiB")
print(f"total: {len(sizes)} countries, {sum(counts.values())} files, "
f"{sum(sizes.values()) / 2**30:.2f} GiB")
def main():
p = argparse.ArgumentParser()
p.add_argument("--repo", default=REPO_ID)
p.add_argument("--revision", default="main")
p.add_argument("--out", default="data/crops", help="Local folder; keeps the country=XX/ layout.")
p.add_argument("--countries", nargs="*", default=None, help="ISO-2 codes, e.g. BY AD CN (default: all).")
p.add_argument("--workers", type=int, default=8)
p.add_argument("--list", action="store_true", help="List countries and sizes, then exit.")
args = p.parse_args()
if args.list:
list_countries(args.repo, args.revision)
return
patterns = ([f"country={c.upper()}/*.arrow" for c in args.countries]
if args.countries else ["country=*/*.arrow"])
path = snapshot_download(repo_id=args.repo, repo_type="dataset", revision=args.revision,
local_dir=args.out, allow_patterns=patterns, max_workers=args.workers)
print(f"downloaded to {path}")
if __name__ == "__main__":
main()
Requires pip install -U huggingface_hub. If the repo is private, run hf auth login first or set HF_TOKEN.
Retry / keep in sync (rerun.sh)
Long downloads can fail on network errors. snapshot_download resumes and skips files that are already complete, so re-running the script is safe. rerun.sh runs a Python script in a loop: it waits success_wait seconds after a success and fail_wait seconds after a failure, and stops after max_runs runs (0 = never stop).
chmod +x rerun.sh
# retry every 5 min on failure, re-sync every hour after success; give all three numbers before `--`
nohup ./rerun.sh download_lpr.py 3600 300 0 -- --out data/crops > rerun.log 2>&1 &
# one country: 3 runs total, 5 min apart (later runs only fetch what's missing or new)
./rerun.sh download_lpr.py 300 300 3 -- --out data/crops --countries BY
Save as rerun.sh:
#!/usr/bin/env bash
# Re-run a Python script forever: wait SUCCESS_WAIT after success, FAIL_WAIT after failure.
# Usage: ./rerun.sh script.py [success_wait_sec] [fail_wait_sec] [max_runs] [-- script args...]
# ./rerun.sh /home/jovyan/test.py 3600 300
# ./rerun.sh test.py 3600 300 0 -- --country VN # max_runs 0 = unlimited
# nohup ./rerun.sh test.py 3600 300 > rerun.log 2>&1 &
set -u
SCRIPT="${1:?usage: $0 script.py [success_wait] [fail_wait] [max_runs] [-- args]}"
SUCCESS_WAIT="${2:-3600}"
FAIL_WAIT="${3:-300}"
MAX_RUNS="${4:-0}"
shift $(( $# < 4 ? $# : 4 ))
[ "${1:-}" = "--" ] && shift
ARGS=("$@")
PYTHON="${PYTHON:-python}"
trap 'echo "$(date "+%F %T") stopped"; exit 0' INT TERM
run=0
while true; do
run=$((run + 1))
echo "$(date '+%F %T') run #$run: $PYTHON $SCRIPT ${ARGS[*]:-}"
"$PYTHON" "$SCRIPT" "${ARGS[@]}"
code=$?
if [ "$code" -eq 0 ]; then wait_s=$SUCCESS_WAIT; status=OK; else wait_s=$FAIL_WAIT; status="FAILED(exit $code)"; fi
echo "$(date '+%F %T') run #$run $status; next run in ${wait_s}s"
if [ "$MAX_RUNS" -gt 0 ] && [ "$run" -ge "$MAX_RUNS" ]; then echo "reached max_runs=$MAX_RUNS"; exit "$code"; fi
sleep "$wait_s" &
wait $!
done
Load
import io, glob, re
import pyarrow as pa
from PIL import Image
for path in sorted(glob.glob("data/crops/country=*/*.arrow")):
country = re.search(r"country=([A-Z]{2})", path).group(1)
table = pa.ipc.open_file(pa.memory_map(path)).read_all()
row = table.slice(0, 1).to_pylist()[0]
img = Image.open(io.BytesIO(row["crop_bytes"])).convert("RGB")
print(country, row["plate_text"], row["split"], img.size)
break
With 🤗 Datasets (streaming avoids downloading everything first):
from datasets import load_dataset
ds = load_dataset("quangduc/lpr", split="train", streaming=True) # the HF "train" split here = all rows; filter on the `split` column
Licensing
Rows come from several sources with different licenses, given per row in the license column:
license |
Example sources |
|---|---|
| MIT | ccpd |
| CC-BY-4.0 | autoria_* |
| platesmania-attribution | platesmania |
| proprietary-viettel | viettel_combvt |
Check the license of each row's source before using or redistributing it. Rows marked proprietary-viettel are not licensed for public redistribution unless you hold rights to them.
set -u SCRIPT="${1:?usage: $0 script.py [success_wait] [fail_wait] [max_runs] [-- args]}" SUCCESS_WAIT="${2:-3600}" FAIL_WAIT="${3:-300}" MAX_RUNS="${4:-0}" shift $(( $# < 4 ? $# : 4 )) [ "${1:-}" = "--" ] && shift ARGS=("$@")
PYTHON="${PYTHON:-python}" trap 'echo "$(date "+%F %T") stopped"; exit 0' INT TERM
run=0 while true; do run=$((run + 1)) echo "$(date '+%F %T') run #$run: $PYTHON $SCRIPT ${ARGS[*]:-}" "$PYTHON" "$SCRIPT" "${ARGS[@]}" code=$? if [ "$code" -eq 0 ]; then wait_s=$SUCCESS_WAIT; status=OK; else wait_s=$FAIL_WAIT; status="FAILED(exit $code)"; fi echo "$(date '+%F %T') run #$run $status; next run in ${wait_s}s" if [ "$MAX_RUNS" -gt 0 ] && [ "$run" -ge "$MAX_RUNS" ]; then echo "reached max_runs=$MAX_RUNS"; exit "$code"; fi sleep "$wait_s" & wait $! done
- Downloads last month
- 31