Dataset: add READMEs, organize scripts, update .gitignore
- Add README.md to all 16 dataset directories with script references - Centralize generation scripts under scripts/ with full README - Update .gitignore to cover all data directories, keep only metadata - Remove redundant CCPD/.gitignore (parent covers same rules) - Remove stale scripts/test/ (254MB pipeline residue) - Fix label parser reference: scripts are authoritative source of truth
This commit is contained in:
1 parent
7867c3bfaf
commit
a64690477a
43 files changed
+2691
-205
No files matched your search
@@ -184,6 +184,8 @@ static string bg_color_of(const string& plate_type) {
|
||||
if (plate_type == "lingguan_old" || plate_type == "lingguan_new") return "black";
|
||||
if (plate_type == "coach") return "yellow";
|
||||
if (plate_type == "new_energy") return "green_truck";
|
||||
if (plate_type == "blue") return "blue";
|
||||
if (plate_type == "green") return "green_car";
|
||||
return "white";
|
||||
}
|
||||
|
||||
@@ -322,7 +324,7 @@ Mat match_plate_color(const Mat& synthetic, const Mat& orig_roi,
|
||||
|
||||
// 白/绿牌
|
||||
Scalar color_cast(white_ref[0]/ref_mean, white_ref[1]/ref_mean, white_ref[2]/ref_mean);
|
||||
float strength = (bg_color == "green_truck") ? 1.5f : 1.0f;
|
||||
float strength = (bg_color == "green_truck" || bg_color == "green_car") ? 1.5f : 1.0f;
|
||||
Scalar amplified(1.0f + (color_cast[0]-1.0f)*strength, 1.0f+(color_cast[1]-1.0f)*strength, 1.0f+(color_cast[2]-1.0f)*strength);
|
||||
amplified[0] = std::clamp((float)amplified[0], 0.85f, 1.15f);
|
||||
amplified[1] = std::clamp((float)amplified[1], 0.85f, 1.15f);
|
||||
@@ -359,7 +361,8 @@ Mat fix_bg_color(const Mat& plate, const string& bg_color,
|
||||
|
||||
int h_lo = 0, h_hi = 180;
|
||||
if (bg_color == "yellow") { h_lo = 15; h_hi = 50; }
|
||||
else if (bg_color == "green_truck") { h_lo = 40; h_hi = 85; }
|
||||
else if (bg_color == "green_truck" || bg_color == "green_car") { h_lo = 40; h_hi = 85; }
|
||||
else if (bg_color == "blue") { h_lo = 90; h_hi = 130; }
|
||||
|
||||
Mat hsv;
|
||||
cvtColor(plate, hsv, COLOR_BGR2HSV);
|
||||
@@ -629,7 +632,7 @@ bool process_single(const string& img_path, const SwapConfig& cfg,
|
||||
if (current_w > 10 && abs(target_w - current_w) > 10) {
|
||||
float l_ratio = target_w / current_w;
|
||||
float min_c = 0.5f, max_c = 1.1f;
|
||||
if (bg_color == "green_truck" || bg_color == "yellow") { min_c = 0.4f; max_c = 1.0f; }
|
||||
if (bg_color == "green_truck" || bg_color == "green_car" || bg_color == "yellow") { min_c = 0.4f; max_c = 1.0f; }
|
||||
else if (bg_color == "black" || bg_color == "black_shi") { min_c = 0.3f; max_c = 1.2f; }
|
||||
l_ratio = std::clamp(l_ratio, min_c, max_c);
|
||||
|
||||
@@ -650,38 +653,16 @@ bool process_single(const string& img_path, const SwapConfig& cfg,
|
||||
}
|
||||
|
||||
// 8. Degradation
|
||||
if (!cfg.fast_mode)
|
||||
matched = degrade_plate(matched);
|
||||
matched = degrade_plate(matched);
|
||||
|
||||
// 9-11. Warp + blend + noise
|
||||
auto [warped, mask] = warp_plate_back(matched, meta.corners, Size(w_img, h_img));
|
||||
Mat blended = feather_blend(img_orig, warped, mask);
|
||||
Mat final = match_noise(blended, img_orig, mask);
|
||||
|
||||
// 12. Save with pinyin tags
|
||||
// 12. Save with original Chinese plate number (imwrite_unicode supports UTF-8)
|
||||
string stem = fp.stem().string();
|
||||
// Convert Chinese plate markers to ASCII tags
|
||||
string tag = plate_number;
|
||||
// Manual pinyin mapping for common plate characters (UTF-8 byte sequences)
|
||||
// 港=E6B8AF 澳=E6BEB3 警=E8ADA6 使=E4BDBF 领=E9A286 学=E5ADA6
|
||||
struct { const char* utf8; const char* py; } map[] = {
|
||||
{"\xE6\xB8\xAF", "GANG"}, {"\xE6\xBE\xB3", "AO"},
|
||||
{"\xE8\xAD\xA6", "JING"}, {"\xE4\xBD\xBF", "SHI"},
|
||||
{"\xE9\xA2\x86", "LING"}, {"\xE5\xAD\xA6", "XUE"},
|
||||
};
|
||||
for (auto& m : map) {
|
||||
size_t pos = 0;
|
||||
while ((pos = tag.find(m.utf8, pos)) != string::npos) {
|
||||
tag.replace(pos, 3, m.py);
|
||||
pos += strlen(m.py);
|
||||
}
|
||||
}
|
||||
// Remove any remaining non-ASCII
|
||||
string clean;
|
||||
for (char c : tag) {
|
||||
if ((unsigned char)c < 128) clean += c;
|
||||
}
|
||||
string out_name = stem + "__" + cfg.plate_type + "__" + clean + ".jpg";
|
||||
string out_name = stem + "__" + cfg.plate_type + "__" + plate_number + ".jpg";
|
||||
string ccpd_subdir = fp.parent_path().filename().string();
|
||||
fs::path out_dir = fs::path(cfg.output_dir) / ccpd_subdir / cfg.plate_type;
|
||||
fs::create_directories(out_dir);
|
||||
|
||||
Reference in new issue
Block a user