label-studio-converter 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -248,10 +248,11 @@ label-studio-converter --help
248
248
 
249
249
  ```
250
250
  USAGE
251
- label-studio-converter toLabelStudio [--outDir value] [--fileName value] [--backup] [--defaultLabelName value] [--toFullJson] [--createFilePerImage] [--createFileListForServing] [--fileListName value] [--baseServerUrl value] [--sortVertical value] [--sortHorizontal value] [--normalizeShape value] [--widthIncrement value] [--heightIncrement value] [--precision value] [--recursive] [--filePattern value] [--outputMode value] <args>...
252
- label-studio-converter toPPOCR [--outDir value] [--fileName value] [--backup] [--baseImageDir value] [--sortVertical value] [--sortHorizontal value] [--normalizeShape value] [--widthIncrement value] [--heightIncrement value] [--precision value] [--recursive] [--filePattern value] <args>...
253
- label-studio-converter enhance-labelstudio [--outDir value] [--fileName value] [--backup] [--sortVertical value] [--sortHorizontal value] [--normalizeShape value] [--widthIncrement value] [--heightIncrement value] [--precision value] [--recursive] [--filePattern value] [--outputMode value] <args>...
254
- label-studio-converter enhance-ppocr [--outDir value] [--fileName value] [--backup] [--sortVertical value] [--sortHorizontal value] [--normalizeShape value] [--widthIncrement value] [--heightIncrement value] [--precision value] [--recursive] [--filePattern value] <args>...
251
+ label-studio-converter toLabelStudio [--outDir value] [--fileName value] [--backup] [--recursive] [--filePattern value] [--copyImages] [--imageBaseDir value] [--sortVertical value] [--sortHorizontal value] [--normalizeShape value] [--useOrientedBox] [--widthIncrement value] [--heightIncrement value] [--adaptResize] [--adaptResizeThreshold value] [--adaptResizeMargin value] [--adaptResizeMinComponentSize value] [--adaptResizeMaxComponentSize value] [--adaptResizeOutlierPercentile value] [--adaptResizeMorphologySize value] [--adaptResizeMaxHorizontalExpansion value] [--adaptResizePaddingCheckWidth value] [--adaptResizeMinPaddingBrightness value] [--adaptResizeMinPaddingRatio value] [--adaptResizeUseAdaptiveThreshold] [--adaptResizeAdaptiveBlockSize value] [--precision value] [--defaultLabelName value] [--toFullJson] [--createFilePerImage] [--createFileListForServing] [--fileListName value] [--baseServerUrl value] [--outputMode value] <args>...
252
+ label-studio-converter toPPOCR [--outDir value] [--fileName value] [--backup] [--recursive] [--filePattern value] [--copyImages] [--imageBaseDir value] [--sortVertical value] [--sortHorizontal value] [--normalizeShape value] [--useOrientedBox] [--widthIncrement value] [--heightIncrement value] [--adaptResize] [--adaptResizeThreshold value] [--adaptResizeMargin value] [--adaptResizeMinComponentSize value] [--adaptResizeMaxComponentSize value] [--adaptResizeOutlierPercentile value] [--adaptResizeMorphologySize value] [--adaptResizeMaxHorizontalExpansion value] [--adaptResizePaddingCheckWidth value] [--adaptResizeMinPaddingBrightness value] [--adaptResizeMinPaddingRatio value] [--adaptResizeUseAdaptiveThreshold] [--adaptResizeAdaptiveBlockSize value] [--precision value] [--baseImageDir value] <args>...
253
+ label-studio-converter enhance-labelstudio [--outDir value] [--fileName value] [--backup] [--recursive] [--filePattern value] [--copyImages] [--imageBaseDir value] [--sortVertical value] [--sortHorizontal value] [--normalizeShape value] [--useOrientedBox] [--widthIncrement value] [--heightIncrement value] [--adaptResize] [--adaptResizeThreshold value] [--adaptResizeMargin value] [--adaptResizeMinComponentSize value] [--adaptResizeMaxComponentSize value] [--adaptResizeOutlierPercentile value] [--adaptResizeMorphologySize value] [--adaptResizeMaxHorizontalExpansion value] [--adaptResizePaddingCheckWidth value] [--adaptResizeMinPaddingBrightness value] [--adaptResizeMinPaddingRatio value] [--adaptResizeUseAdaptiveThreshold] [--adaptResizeAdaptiveBlockSize value] [--precision value] [--outputMode value] <args>...
254
+ label-studio-converter enhance-ppocr [--outDir value] [--fileName value] [--backup] [--recursive] [--filePattern value] [--copyImages] [--imageBaseDir value] [--sortVertical value] [--sortHorizontal value] [--normalizeShape value] [--useOrientedBox] [--widthIncrement value] [--heightIncrement value] [--adaptResize] [--adaptResizeThreshold value] [--adaptResizeMargin value] [--adaptResizeMinComponentSize value] [--adaptResizeMaxComponentSize value] [--adaptResizeOutlierPercentile value] [--adaptResizeMorphologySize value] [--adaptResizeMaxHorizontalExpansion value] [--adaptResizePaddingCheckWidth value] [--adaptResizeMinPaddingBrightness value] [--adaptResizeMinPaddingRatio value] [--adaptResizeUseAdaptiveThreshold] [--adaptResizeAdaptiveBlockSize value] [--precision value] <args>...
255
+ label-studio-converter label-studio-output-to-ppocr [--recursive] (--outDir value) [--fileName value] [--removeBaseImageDir value] <args>...
255
256
  label-studio-converter --help
256
257
  label-studio-converter --version
257
258
 
@@ -262,10 +263,11 @@ FLAGS
262
263
  -v --version Print version information and exit
263
264
 
264
265
  COMMANDS
265
- toLabelStudio Convert PPOCRLabel files to Label Studio format
266
- toPPOCR Convert Label Studio files to PPOCRLabel format
267
- enhance-labelstudio Enhance Label Studio files with sorting, normalization, and resizing
268
- enhance-ppocr Enhance PPOCRLabel files with sorting, normalization, and resizing
266
+ toLabelStudio Convert PPOCRLabel files to Label Studio format
267
+ toPPOCR Convert Label Studio files to PPOCRLabel format
268
+ enhance-labelstudio Enhance Label Studio files with sorting, normalization, and resizing
269
+ enhance-ppocr Enhance PPOCRLabel files with sorting, normalization, and resizing
270
+ label-studio-output-to-ppocr Convert Label Studio output files to PPOCRLabel format Enhance PPOCRLabel files with sorting, normalization, and resizing
269
271
  ```
270
272
 
271
273
  #### Command Flags Reference
@@ -280,12 +282,14 @@ COMMANDS
280
282
  - **Example**: `--outDir ./output` saves all files to `./output/`
281
283
 
282
284
  - `--fileName <name>`: Custom output filename
283
- - **Behavior**: Renames output file (without extension for JSON, with extension for txt)
285
+ - **Behavior**: Renames output file (without extension for JSON, with
286
+ extension for txt)
284
287
  - **Default**:
285
288
  - toLabelStudio: `{source}_full.json` or `{source}_min.json`
286
289
  - toPPOCR: `Label.txt`
287
290
  - enhance commands: Same as input filename
288
- - **Example**: `--fileName MyLabels.txt` creates `MyLabels.txt` instead of `Label.txt`
291
+ - **Example**: `--fileName MyLabels.txt` creates `MyLabels.txt` instead of
292
+ `Label.txt`
289
293
 
290
294
  - `--backup` / `--noBackup`: Create backup before overwriting
291
295
  - **Behavior**: Copies existing file to `{filename}.backup` before overwriting
@@ -295,20 +299,41 @@ COMMANDS
295
299
  - `--recursive` / `--noRecursive`: Search subdirectories
296
300
  - **Behavior**: Processes files in all subdirectories recursively
297
301
  - **Default**: `false` (current directory only)
298
- - **Example**: `--recursive` processes `./data/train/Label.txt` and `./data/test/Label.txt`
302
+ - **Example**: `--recursive` processes `./data/train/Label.txt` and
303
+ `./data/test/Label.txt`
299
304
 
300
305
  - `--filePattern <regex>`: Pattern to match input files
301
306
  - **Behavior**: Only processes files matching regex pattern
302
307
  - **Default**:
303
308
  - PPOCRLabel commands: `.*\.txt$` (all .txt files)
304
309
  - Label Studio commands: `.*\.json$` (all .json files)
305
- - **Example**: `--filePattern "train_.*\.txt$"` only processes files starting with `train_`
310
+ - **Example**: `--filePattern "train_.*\.txt$"` only processes files starting
311
+ with `train_`
306
312
 
307
313
  - `--copyImages` / `--noCopyImages`: Copy images when using --outDir
308
- - **Behavior**: When --outDir is specified, automatically copies/moves images to output directory alongside converted files
314
+ - **Behavior**: When --outDir is specified, automatically copies/moves images
315
+ to output directory alongside converted files
309
316
  - **Default**: `true` (copy images)
310
- - **Example**: `--noCopyImages` keeps images in original location, only copies task files
311
- - **Note**: Only applies to toLabelStudio and toPPOCR converters when --outDir is used
317
+ - **Example**: `--noCopyImages` keeps images in original location, only copies
318
+ task files
319
+ - **Note**: Only applies to toLabelStudio and toPPOCR converters when --outDir
320
+ is used
321
+ - **Note**: Not available for `label-studio-output-to-ppocr` command since it
322
+ only processes Label Studio output files which have no image paths
323
+
324
+ - `--imageBaseDir <dir>`: Controls output directory structure when copying images
325
+ - **Behavior**: Determines how the directory structure is preserved when
326
+ copying images to output directory
327
+ - **Options**: `task-file` (relative to task file), `input-dir` (relative to
328
+ input directory)
329
+ - **Default**: `task-file`
330
+ - **Example**: `--imageBaseDir input-dir --copyImages` preserves full path
331
+ structure from input directory
332
+ - **Use case**: Control whether copied images maintain full path from input
333
+ directory or relative to task file
334
+ - **Note**: Only affects output when --copyImages is used with --outDir
335
+ - **Note**: Not available for `label-studio-output-to-ppocr` command since it
336
+ only processes Label Studio output files which have no image paths
312
337
 
313
338
  **Enhancement Flags:**
314
339
 
@@ -319,16 +344,19 @@ COMMANDS
319
344
  - **Example**: `--sortVertical top-bottom` sorts boxes from top to bottom
320
345
 
321
346
  - `--sortHorizontal <order>`: Horizontal sorting order
322
- - **Behavior**: Sorts bounding boxes by horizontal position (applied after vertical sort)
347
+ - **Behavior**: Sorts bounding boxes by horizontal position (applied after
348
+ vertical sort)
323
349
  - **Options**: `none`, `ltr` (left-to-right), `rtl` (right-to-left)
324
350
  - **Default**: `none` (no sorting)
325
- - **Example**: `--sortHorizontal rtl` sorts boxes right-to-left (for vertical text)
351
+ - **Example**: `--sortHorizontal rtl` sorts boxes right-to-left (for vertical
352
+ text)
326
353
 
327
354
  - `--normalizeShape <option>`: Shape normalization
328
355
  - **Behavior**: Converts diamond/rotated shapes to axis-aligned rectangles
329
356
  - **Options**: `none`, `rectangle`
330
357
  - **Default**: `none` (preserve original shapes)
331
- - **Example**: `--normalizeShape rectangle` converts all polygons to rectangles
358
+ - **Example**: `--normalizeShape rectangle` converts all polygons to
359
+ rectangles
332
360
 
333
361
  - `--widthIncrement <pixels>`: Adjust box width
334
362
  - **Behavior**: Adds pixels to box width (can be negative to shrink)
@@ -352,15 +380,18 @@ COMMANDS
352
380
  **Adaptive Resize Flags (Advanced):**
353
381
 
354
382
  - `--adaptResize` / `--noAdaptResize`: Enable intelligent box resizing
355
- - **Behavior**: Uses image analysis to shrink oversized boxes to fit actual text
383
+ - **Behavior**: Uses image analysis to shrink oversized boxes to fit actual
384
+ text
356
385
  - **Default**: `false` (disabled)
357
386
  - **Use Case**: Sino-Nom OCR datasets with excessive padding
358
387
  - **Example**: `--adaptResize` enables feature with default parameters
359
388
 
360
389
  - `--adaptResizeThreshold <0-255>`: Grayscale threshold
361
- - **Behavior**: Pixels ≥ threshold are considered text (white), < threshold are background (black)
390
+ - **Behavior**: Pixels ≥ threshold are considered text (white), < threshold
391
+ are background (black)
362
392
  - **Default**: `128`
363
- - **Example**: `--adaptResizeThreshold 140` for darker text on light background
393
+ - **Example**: `--adaptResizeThreshold 140` for darker text on light
394
+ background
364
395
 
365
396
  - `--adaptResizeMargin <pixels>`: Padding around detected content
366
397
  - **Behavior**: Additional pixels added on all sides after detection
@@ -378,9 +409,11 @@ COMMANDS
378
409
  - **Example**: `--adaptResizeMaxComponentSize 50000` for smaller characters
379
410
 
380
411
  - `--adaptResizeOutlierPercentile <%>`: Outlier removal
381
- - **Behavior**: Ignores this % of smallest and largest pixels when calculating boundaries
412
+ - **Behavior**: Ignores this % of smallest and largest pixels when calculating
413
+ boundaries
382
414
  - **Default**: `2` (ignore 2% on each end)
383
- - **Example**: `--adaptResizeOutlierPercentile 3` for more aggressive outlier removal
415
+ - **Example**: `--adaptResizeOutlierPercentile 3` for more aggressive outlier
416
+ removal
384
417
 
385
418
  - `--adaptResizeMorphologySize <pixels>`: Stroke connection
386
419
  - **Behavior**: Kernel size for connecting broken character strokes
@@ -388,7 +421,8 @@ COMMANDS
388
421
  - **Example**: `--adaptResizeMorphologySize 3` connects larger gaps
389
422
 
390
423
  - `--adaptResizeMaxHorizontalExpansion <pixels>`: Column overlap prevention
391
- - **Behavior**: Maximum pixels boxes can expand horizontally (CRITICAL for vertical text)
424
+ - **Behavior**: Maximum pixels boxes can expand horizontally (CRITICAL for
425
+ vertical text)
392
426
  - **Default**: `50`
393
427
  - **Example**: `--adaptResizeMaxHorizontalExpansion 30` for closely-spaced columns
394
428
 
@@ -397,10 +431,12 @@ COMMANDS
397
431
  - `--defaultLabelName <name>`: Default label for annotations
398
432
  - **Behavior**: Label assigned to all text regions
399
433
  - **Default**: `"Text"`
400
- - **Example**: `--defaultLabelName "Handwriting"` labels all regions as Handwriting
434
+ - **Example**: `--defaultLabelName "Handwriting"` labels all regions as
435
+ Handwriting
401
436
 
402
437
  - `--toFullJson` / `--noToFullJson`: Output format
403
- - **Behavior**: `true` = Full format (more metadata), `false` = Min format (compact)
438
+ - **Behavior**: `true` = Full format (more metadata), `false` = Min format
439
+ (compact)
404
440
  - **Default**: `true` (Full format)
405
441
  - **Example**: `--noToFullJson` creates minimal format files
406
442
 
@@ -409,7 +445,8 @@ COMMANDS
409
445
  - **Default**: `false` (single file)
410
446
  - **Example**: `--createFilePerImage` creates `image1.json`, `image2.json`, etc.
411
447
 
412
- - `--createFileListForServing` / `--noCreateFileListForServing`: Generate file list
448
+ - `--createFileListForServing` / `--noCreateFileListForServing`: Generate file
449
+ list
413
450
  - **Behavior**: Creates `files.txt` with image URLs for Label Studio import
414
451
  - **Default**: `true` (create file list)
415
452
  - **Example**: `--noCreateFileListForServing` skips file list creation
@@ -420,7 +457,8 @@ COMMANDS
420
457
  - **Example**: `--fileListName "images.txt"` creates `images.txt` instead
421
458
 
422
459
  - `--baseServerUrl <url>`: Base URL for images
423
- - **Behavior**: Prepended to image paths in output JSON (e.g., for local HTTP server)
460
+ - **Behavior**: Prepended to image paths in output JSON (e.g., for local HTTP
461
+ server)
424
462
  - **Default**: `"http://localhost:8081"`
425
463
  - **Example**: `--baseServerUrl "http://192.168.1.100:8080"` for network access
426
464
 
@@ -436,17 +474,30 @@ COMMANDS
436
474
  - `--baseImageDir <path>`: Image directory prefix
437
475
  - **Behavior**: Prepended to image filenames in output `Label.txt`
438
476
  - **Default**: Empty string (no prefix)
439
- - **Example**: `--baseImageDir "images/ch"` writes `images/ch/example.jpg` in Label.txt
477
+ - **Example**: `--baseImageDir "images/ch"` writes `images/ch/example.jpg` in
478
+ Label.txt
440
479
 
441
480
  ##### Flags Specific to enhance-labelstudio Command
442
481
 
443
482
  - `--outputMode <mode>`: Same as toLabelStudio command
444
483
  - See toLabelStudio flags section above
445
484
 
485
+ ##### Flags Specific to label-studio-output-to-ppocr Command
486
+
487
+ - `--removeBaseImageDir <dir>`: Remove base directory from image paths
488
+ - **Behavior**: Strips specified base directory from image paths in output
489
+ `Label.txt`
490
+ - **Default**: `"/data/local-files/?d="` (removes Label Studio's default local
491
+ file prefix)
492
+ - **Example**: `--removeBaseImageDir "data/"` converts `data/example.jpg` to
493
+ `example.jpg` in Label.txt
494
+
446
495
  #### Image Path Resolution Logic
447
496
 
448
497
  Understanding how image paths are resolved is critical for organizing your files before conversion. The key is knowing **where you run the command** and **what input parameter you provide**.
449
498
 
499
+ > **New in v1.5.0**: The `--imageBaseDir` flag controls the output directory structure when copying images. It determines whether copied images maintain their path relative to the task file (`task-file`, default) or the input directory (`input-dir`).
500
+
450
501
  ##### toLabelStudio: PPOCRLabel → Label Studio
451
502
 
452
503
  **INPUT Resolution (Reading PPOCRLabel files):**
@@ -459,7 +510,7 @@ Understanding how image paths are resolved is critical for organizing your files
459
510
  - Converter finds: `project/data/Label.txt` (and other Label.txt files in subdirectories if --recursive)
460
511
  - Task file being processed: `project/data/Label.txt`
461
512
 
462
- **How Resolvers Work:**
513
+ **How Image Paths Are Read:**
463
514
 
464
515
  1. **What's in the Label.txt file**:
465
516
  - Path format: `data/example.jpg` (PPOCRLabel standard: folder/filename)
@@ -473,22 +524,30 @@ Understanding how image paths are resolved is critical for organizing your files
473
524
  - YES → resolve from parent: `dirname(project/data/) + data/example.jpg` = `project/data/example.jpg`
474
525
  - NO → resolve from task dir: `project/data/ + example.jpg` = `project/data/example.jpg`
475
526
 
476
- 3. **What the processor receives**:
477
- - Path relative to CWD: `data/example.jpg`
478
- - (This is `relative(project/, project/data/example.jpg)` = `data/example.jpg`)
527
+ **OUTPUT Resolution (Copying images with --copyImages --outDir):**
479
528
 
480
- **OUTPUT Resolution (Writing Label Studio JSON):**
529
+ **With `--imageBaseDir task-file` (default):**
481
530
 
482
- **Command Execution Context:**
531
+ When copying images to output directory, paths are maintained **relative to the task file location**:
483
532
 
484
- - Output location: Same as task file location (no --outDir specified)
485
- - Output file: `project/data/Label_full.json`
533
+ - Input directory: `project/data/` (provided to command)
534
+ - Source image: `project/data/foo/bar/baz/example.jpg`
535
+ - Task file: `project/data/Label.txt`
536
+ - Output dir: `project/output/`
537
+ - Relative from task: `relative(project/data/, project/data/foo/bar/baz/example.jpg)` = `foo/bar/baz/example.jpg`
538
+ - Destination: `project/output/data/foo/bar/baz/example.jpg` (maintains structure relative to task file)
486
539
 
487
- **How Resolvers Work:**
540
+ **With `--imageBaseDir input-dir`:**
488
541
 
489
- 1. **What the processor has**:
490
- - Path relative to CWD: `data/example.jpg`
491
- - (From input resolution step)
542
+ When copying images to output directory, paths are maintained **relative to input directory**:
543
+
544
+ - Input directory: `project/data/` (provided to command)
545
+ - Source image: `project/data/foo/bar/baz/example.jpg`
546
+ - Output dir: `project/output/`
547
+ - Relative from input: `relative(project/data/, project/data/foo/bar/baz/example.jpg)` = `foo/bar/baz/example.jpg`
548
+ - Destination: `project/output/foo/bar/baz/example.jpg` (maintains path from input directory)
549
+ - Path relative to CWD: `data/example.jpg`
550
+ - (From input resolution step)
492
551
 
493
552
  2. **How output resolver formats paths**:
494
553
  - No --outDir: Compute relative path from output JSON to image
@@ -619,7 +678,7 @@ project/
619
678
  - Converter finds: `project/data/export.json` (and other JSON files in subdirectories if --recursive)
620
679
  - Task file being processed: `project/data/export.json`
621
680
 
622
- **How Resolvers Work:**
681
+ **How Image Paths Are Read:**
623
682
 
624
683
  1. **What's in the JSON file**:
625
684
  - Local path: `"ocr": "/example.jpg"` or `"ocr": "example.jpg"`
@@ -634,16 +693,28 @@ project/
634
693
  - Extract filename: `basename(URL)` = `example.jpg`
635
694
  - Download to task directory: `project/data/example.jpg`
636
695
 
637
- 3. **What the processor receives**:
638
- - Path relative to CWD: `data/example.jpg`
639
- - (This is `relative(project/, project/data/example.jpg)` = `data/example.jpg`)
696
+ **OUTPUT Resolution (Copying images with --copyImages --outDir):**
640
697
 
641
- **OUTPUT Resolution (Writing PPOCRLabel Label.txt):**
698
+ **With `--imageBaseDir task-file` (default):**
642
699
 
643
- **Command Execution Context:**
700
+ When copying images to output directory, paths are maintained **relative to the task file location**:
644
701
 
645
- - No --outDir specified: Output at task file location
646
- - Output file: `project/data/Label.txt`
702
+ - Input directory: `project/data/` (provided to command)
703
+ - Source image: `project/data/foo/bar/baz/example.jpg`
704
+ - Task file: `project/data/export.json`
705
+ - Output dir: `project/output/`
706
+ - Relative from task: `relative(project/data/, project/data/foo/bar/baz/example.jpg)` = `foo/bar/baz/example.jpg`
707
+ - Destination: `project/output/data/foo/bar/baz/example.jpg` (maintains structure relative to task file)
708
+
709
+ **With `--imageBaseDir input-dir`:**
710
+
711
+ When copying images to output directory, paths are maintained **relative to input directory**:
712
+
713
+ - Input directory: `project/data/` (provided to command)
714
+ - Source image: `project/data/foo/bar/baz/example.jpg`
715
+ - Output dir: `project/output/`
716
+ - Relative from input: `relative(project/data/, project/data/foo/bar/baz/example.jpg)` = `foo/bar/baz/example.jpg`
717
+ - Destination: `project/output/foo/bar/baz/example.jpg` (maintains path from input directory)
647
718
 
648
719
  **How Resolvers Work:**
649
720
 
@@ -793,6 +864,18 @@ output/example.jpg [{"transcription":"Text","points":[[...]],"dt_score":1}]
793
864
  - Uses `baseImageDir` or output directory basename as folder prefix
794
865
  - Extracts filename from resolved path, prepends folder name
795
866
 
867
+ ##### label-studio-output-to-ppocr: Label Studio Output → PPOCRLabel
868
+
869
+ **INPUT Resolution**:
870
+
871
+ - Reads Label Studio output JSON files
872
+ - Strips `removeBaseImageDir` prefix from image paths (e.g.,
873
+ `data/local-files/?d=example.jpg` → `example.jpg`)
874
+
875
+ **OUTPUT Resolution**:
876
+
877
+ - Generates PPOCRLabel Label.txt with `folder/filename.jpg` format
878
+
796
879
  ---
797
880
 
798
881
  **Key Concepts:**
@@ -839,31 +922,47 @@ label-studio-converter toLabelStudio --help
839
922
 
840
923
  ```
841
924
  USAGE
842
- label-studio-converter toLabelStudio [--outDir value] [--fileName value] [--backup] [--defaultLabelName value] [--toFullJson] [--createFilePerImage] [--createFileListForServing] [--fileListName value] [--baseServerUrl value] [--sortVertical value] [--sortHorizontal value] [--normalizeShape value] [--widthIncrement value] [--heightIncrement value] [--precision value] [--recursive] [--filePattern value] [--outputMode value] <args>...
925
+ label-studio-converter toLabelStudio [--outDir value] [--fileName value] [--backup] [--recursive] [--filePattern value] [--copyImages] [--imageBaseDir value] [--sortVertical value] [--sortHorizontal value] [--normalizeShape value] [--useOrientedBox] [--widthIncrement value] [--heightIncrement value] [--adaptResize] [--adaptResizeThreshold value] [--adaptResizeMargin value] [--adaptResizeMinComponentSize value] [--adaptResizeMaxComponentSize value] [--adaptResizeOutlierPercentile value] [--adaptResizeMorphologySize value] [--adaptResizeMaxHorizontalExpansion value] [--adaptResizePaddingCheckWidth value] [--adaptResizeMinPaddingBrightness value] [--adaptResizeMinPaddingRatio value] [--adaptResizeUseAdaptiveThreshold] [--adaptResizeAdaptiveBlockSize value] [--precision value] [--defaultLabelName value] [--toFullJson] [--createFilePerImage] [--createFileListForServing] [--fileListName value] [--baseServerUrl value] [--outputMode value] <args>...
843
926
  label-studio-converter toLabelStudio --help
844
927
 
845
928
  Convert PPOCRLabel files to Label Studio format
846
929
 
847
930
  FLAGS
848
- [--outDir] Output directory. If not specified, files are saved in the same directory as the source files
849
- [--fileName] Custom output filename (without extension). If not specified, uses source filename with format suffix
850
- [--backup/--noBackup] Create backup of existing files before overwriting. Default: false
851
- [--defaultLabelName] Default label name for text annotations. Default: "Text"
852
- [--toFullJson/--noToFullJson] Convert to Full OCR Label Studio format. Default: "true"
853
- [--createFilePerImage/--noCreateFilePerImage] Create a separate Label Studio JSON file for each image. Default: "false"
854
- [--createFileListForServing/--noCreateFileListForServing] Create a file list for serving in Label Studio. Default: "true"
855
- [--fileListName] Name of the file list for serving. Default: "files.txt"
856
- [--baseServerUrl] Base server URL for constructing image URLs in the file list. Default: "http://localhost:8081"
857
- [--sortVertical] Sort bounding boxes vertically. Options: "none", "top-bottom", "bottom-top". Default: "none"
858
- [--sortHorizontal] Sort bounding boxes horizontally. Options: "none", "ltr", "rtl". Default: "none"
859
- [--normalizeShape] Normalize diamond-like shapes to axis-aligned rectangles. Options: "none", "rectangle". Default: "none"
860
- [--widthIncrement] Increase bounding box width by this amount (in pixels). Can be negative to decrease. Default: 0
861
- [--heightIncrement] Increase bounding box height by this amount (in pixels). Can be negative to decrease. Default: 0
862
- [--precision] Number of decimal places for coordinates. Use -1 for full precision (no rounding). Default: -1
863
- [--recursive/--noRecursive] Recursively search directories for files. Default: false
864
- [--filePattern] Regex pattern to match PPOCRLabel files (should match .txt files). Default: ".*\.txt$"
865
- [--outputMode] Output mode: "annotations" for editable annotations (ground truth) or "predictions" for read-only predictions (pre-annotations). Default: "annotations"
866
- -h --help Print help information and exit
931
+ [--outDir] Output directory. If not specified, files are saved in the same directory as the source files
932
+ [--fileName] Custom output filename (without extension). If not specified, uses source filename with format suffix
933
+ [--backup/--noBackup] Create backup of existing files before overwriting. Default: false
934
+ [--recursive/--noRecursive] Recursively search directories for files. Default: false
935
+ [--filePattern] Regex pattern to match PPOCRLabel files (should match .txt files). Default: ".*\.txt$"
936
+ [--copyImages/--noCopyImages] Copy images to output directory when --outDir is specified. Only applies to toLabelStudio and toPPOCR commands. Default: true
937
+ [--imageBaseDir] Base directory for resolving image paths. Options: "task-file" (relative to task file location), "input-dir" (relative to command execution directory). Default: "task-file"
938
+ [--sortVertical] Sort bounding boxes vertically. Options: "none", "top-bottom", "bottom-top". Default: "none"
939
+ [--sortHorizontal] Sort bounding boxes horizontally. Options: "none", "ltr", "rtl". Default: "none"
940
+ [--normalizeShape] Normalize diamond-like shapes to axis-aligned rectangles. Options: "none", "rectangle". Default: "none"
941
+ [--useOrientedBox/--noUseOrientedBox] Use oriented (rotated) bounding box when normalizing shapes. Useful for skewed text. Default: false
942
+ [--widthIncrement] Increase bounding box width by this amount (in pixels). Can be negative to decrease. Default: 0
943
+ [--heightIncrement] Increase bounding box height by this amount (in pixels). Can be negative to decrease. Default: 0
944
+ [--adaptResize/--noAdaptResize] Apply adaptive resize to automatically adjust bounding boxes based on image content. Default: false
945
+ [--adaptResizeThreshold] Grayscale threshold for adaptive resize (0-255). Default: 128
946
+ [--adaptResizeMargin] Margin pixels around detected content for adaptive resize. Default: 5
947
+ [--adaptResizeMinComponentSize] Minimum component size in pixels (filters dirt/noise). Default: 10
948
+ [--adaptResizeMaxComponentSize] Maximum component size in pixels (filters large artifacts). Default: 100000
949
+ [--adaptResizeOutlierPercentile] Percentile for outlier removal (0-100). Default: 2
950
+ [--adaptResizeMorphologySize] Morphological operation kernel size. Default: 2
951
+ [--adaptResizeMaxHorizontalExpansion] Maximum horizontal expansion in pixels (prevents column overlap). Default: 50
952
+ [--adaptResizePaddingCheckWidth] Width of padding strip to validate (in pixels). Default: 3
953
+ [--adaptResizeMinPaddingBrightness] Minimum brightness for white padding pixels (0-255). Default: 200
954
+ [--adaptResizeMinPaddingRatio] Minimum ratio of white pixels in padding strip (0-1). Default: 0.85
955
+ [--adaptResizeUseAdaptiveThreshold/--noAdaptResizeUseAdaptiveThreshold] Use adaptive thresholding based on image histogram (recommended). Default: true
956
+ [--adaptResizeAdaptiveBlockSize] Block size for adaptive thresholding. Default: 50
957
+ [--precision] Number of decimal places for coordinates. Use -1 for full precision (no rounding). Default: 0 (integers)
958
+ [--defaultLabelName] Default label name for text annotations. Default: "Text"
959
+ [--toFullJson/--noToFullJson] Convert to Full OCR Label Studio format. Default: "true"
960
+ [--createFilePerImage/--noCreateFilePerImage] Create a separate Label Studio JSON file for each image. Default: "false"
961
+ [--createFileListForServing/--noCreateFileListForServing] Create a file list for serving in Label Studio. Default: "true"
962
+ [--fileListName] Name of the file list for serving. Default: "files.txt"
963
+ [--baseServerUrl] Base server URL for constructing image URLs in the file list. Default: "http://localhost:8081"
964
+ [--outputMode] Output mode: "annotations" for editable annotations (ground truth) or "predictions" for read-only predictions (pre-annotations). Default: "annotations"
965
+ -h --help Print help information and exit
867
966
 
868
967
  ARGUMENTS
869
968
  args... Input directories containing PPOCRLabel files
@@ -879,25 +978,41 @@ label-studio-converter toPPOCR --help
879
978
 
880
979
  ```
881
980
  USAGE
882
- label-studio-converter toPPOCR [--outDir value] [--fileName value] [--backup] [--baseImageDir value] [--sortVertical value] [--sortHorizontal value] [--normalizeShape value] [--widthIncrement value] [--heightIncrement value] [--precision value] [--recursive] [--filePattern value] <args>...
981
+ label-studio-converter toPPOCR [--outDir value] [--fileName value] [--backup] [--recursive] [--filePattern value] [--copyImages] [--imageBaseDir value] [--sortVertical value] [--sortHorizontal value] [--normalizeShape value] [--useOrientedBox] [--widthIncrement value] [--heightIncrement value] [--adaptResize] [--adaptResizeThreshold value] [--adaptResizeMargin value] [--adaptResizeMinComponentSize value] [--adaptResizeMaxComponentSize value] [--adaptResizeOutlierPercentile value] [--adaptResizeMorphologySize value] [--adaptResizeMaxHorizontalExpansion value] [--adaptResizePaddingCheckWidth value] [--adaptResizeMinPaddingBrightness value] [--adaptResizeMinPaddingRatio value] [--adaptResizeUseAdaptiveThreshold] [--adaptResizeAdaptiveBlockSize value] [--precision value] [--baseImageDir value] <args>...
883
982
  label-studio-converter toPPOCR --help
884
983
 
885
984
  Convert Label Studio files to PPOCRLabel format
886
985
 
887
986
  FLAGS
888
- [--outDir] Output directory. If not specified, files are saved in the same directory as the source files
889
- [--fileName] Output PPOCR file name. Default: "Label.txt"
890
- [--backup/--noBackup] Create backup of existing files before overwriting. Default: false
891
- [--baseImageDir] Base directory path to prepend to image filenames in output (e.g., "ch" or "images/ch")
892
- [--sortVertical] Sort bounding boxes vertically. Options: "none", "top-bottom", "bottom-top". Default: "none"
893
- [--sortHorizontal] Sort bounding boxes horizontally. Options: "none", "ltr", "rtl". Default: "none"
894
- [--normalizeShape] Normalize diamond-like shapes to axis-aligned rectangles. Options: "none", "rectangle". Default: "none"
895
- [--widthIncrement] Increase bounding box width by this amount (in pixels). Can be negative to decrease. Default: 0
896
- [--heightIncrement] Increase bounding box height by this amount (in pixels). Can be negative to decrease. Default: 0
897
- [--precision] Number of decimal places for coordinates. Use -1 for full precision (no rounding). Default: 0 (integers)
898
- [--recursive/--noRecursive] Recursively search directories for files. Default: false
899
- [--filePattern] Regex pattern to match Label Studio files (should match .json files). Default: ".*\.json$"
900
- -h --help Print help information and exit
987
+ [--outDir] Output directory. If not specified, files are saved in the same directory as the source files
988
+ [--fileName] Output PPOCR file name. Default: "Label.txt"
989
+ [--backup/--noBackup] Create backup of existing files before overwriting. Default: false
990
+ [--recursive/--noRecursive] Recursively search directories for files. Default: false
991
+ [--filePattern] Regex pattern to match Label Studio files (should match .json files). Default: ".*\.json$"
992
+ [--copyImages/--noCopyImages] Copy images to output directory when --outDir is specified. Only applies to toLabelStudio and toPPOCR commands. Default: true
993
+ [--imageBaseDir] Base directory for resolving image paths. Options: "task-file" (relative to task file location), "input-dir" (relative to command execution directory). Default: "task-file"
994
+ [--sortVertical] Sort bounding boxes vertically. Options: "none", "top-bottom", "bottom-top". Default: "none"
995
+ [--sortHorizontal] Sort bounding boxes horizontally. Options: "none", "ltr", "rtl". Default: "none"
996
+ [--normalizeShape] Normalize diamond-like shapes to axis-aligned rectangles. Options: "none", "rectangle". Default: "none"
997
+ [--useOrientedBox/--noUseOrientedBox] Use oriented (rotated) bounding box when normalizing shapes. Useful for skewed text. Default: false
998
+ [--widthIncrement] Increase bounding box width by this amount (in pixels). Can be negative to decrease. Default: 0
999
+ [--heightIncrement] Increase bounding box height by this amount (in pixels). Can be negative to decrease. Default: 0
1000
+ [--adaptResize/--noAdaptResize] Apply adaptive resize to automatically adjust bounding boxes based on image content. Default: false
1001
+ [--adaptResizeThreshold] Grayscale threshold for adaptive resize (0-255). Default: 128
1002
+ [--adaptResizeMargin] Margin pixels around detected content for adaptive resize. Default: 5
1003
+ [--adaptResizeMinComponentSize] Minimum component size in pixels (filters dirt/noise). Default: 10
1004
+ [--adaptResizeMaxComponentSize] Maximum component size in pixels (filters large artifacts). Default: 100000
1005
+ [--adaptResizeOutlierPercentile] Percentile for outlier removal (0-100). Default: 2
1006
+ [--adaptResizeMorphologySize] Morphological operation kernel size. Default: 2
1007
+ [--adaptResizeMaxHorizontalExpansion] Maximum horizontal expansion in pixels (prevents column overlap). Default: 50
1008
+ [--adaptResizePaddingCheckWidth] Width of padding strip to validate (in pixels). Default: 3
1009
+ [--adaptResizeMinPaddingBrightness] Minimum brightness for white padding pixels (0-255). Default: 200
1010
+ [--adaptResizeMinPaddingRatio] Minimum ratio of white pixels in padding strip (0-1). Default: 0.85
1011
+ [--adaptResizeUseAdaptiveThreshold/--noAdaptResizeUseAdaptiveThreshold] Use adaptive thresholding based on image histogram (recommended). Default: true
1012
+ [--adaptResizeAdaptiveBlockSize] Block size for adaptive thresholding. Default: 50
1013
+ [--precision] Number of decimal places for coordinates. Use -1 for full precision (no rounding). Default: 0 (integers)
1014
+ [--baseImageDir] Base directory path to prepend to image filenames in output (e.g., "ch" or "images/ch")
1015
+ -h --help Print help information and exit
901
1016
 
902
1017
  ARGUMENTS
903
1018
  args... Input directories containing Label Studio files
@@ -913,25 +1028,41 @@ label-studio-converter enhance-labelstudio --help
913
1028
 
914
1029
  ```
915
1030
  USAGE
916
- label-studio-converter enhance-labelstudio [--outDir value] [--fileName value] [--backup] [--sortVertical value] [--sortHorizontal value] [--normalizeShape value] [--widthIncrement value] [--heightIncrement value] [--precision value] [--recursive] [--filePattern value] [--outputMode value] <args>...
1031
+ label-studio-converter enhance-labelstudio [--outDir value] [--fileName value] [--backup] [--recursive] [--filePattern value] [--copyImages] [--imageBaseDir value] [--sortVertical value] [--sortHorizontal value] [--normalizeShape value] [--useOrientedBox] [--widthIncrement value] [--heightIncrement value] [--adaptResize] [--adaptResizeThreshold value] [--adaptResizeMargin value] [--adaptResizeMinComponentSize value] [--adaptResizeMaxComponentSize value] [--adaptResizeOutlierPercentile value] [--adaptResizeMorphologySize value] [--adaptResizeMaxHorizontalExpansion value] [--adaptResizePaddingCheckWidth value] [--adaptResizeMinPaddingBrightness value] [--adaptResizeMinPaddingRatio value] [--adaptResizeUseAdaptiveThreshold] [--adaptResizeAdaptiveBlockSize value] [--precision value] [--outputMode value] <args>...
917
1032
  label-studio-converter enhance-labelstudio --help
918
1033
 
919
1034
  Enhance Label Studio files with sorting, normalization, and resizing
920
1035
 
921
1036
  FLAGS
922
- [--outDir] Output directory. If not specified, files are saved in the same directory as the source files
923
- [--fileName] Custom output filename. If not specified, uses the same name as the source file
924
- [--backup/--noBackup] Create backup of existing files before overwriting. Default: false
925
- [--sortVertical] Sort bounding boxes vertically. Options: "none", "top-bottom", "bottom-top". Default: "none"
926
- [--sortHorizontal] Sort bounding boxes horizontally. Options: "none", "ltr", "rtl". Default: "none"
927
- [--normalizeShape] Normalize diamond-like shapes to axis-aligned rectangles. Options: "none", "rectangle". Default: "none"
928
- [--widthIncrement] Increase bounding box width by this amount (in pixels). Can be negative to decrease. Default: 0
929
- [--heightIncrement] Increase bounding box height by this amount (in pixels). Can be negative to decrease. Default: 0
930
- [--precision] Number of decimal places for coordinates. Use -1 for full precision (no rounding). Default: -1
931
- [--recursive/--noRecursive] Recursively search directories for files. Default: false
932
- [--filePattern] Regex pattern to match Label Studio files (should match .json files). Default: ".*\.json$"
933
- [--outputMode] Output mode: "annotations" for editable annotations (ground truth) or "predictions" for read-only predictions (pre-annotations). Default: "annotations"
934
- -h --help Print help information and exit
1037
+ [--outDir] Output directory. If not specified, files are saved in the same directory as the source files
1038
+ [--fileName] Custom output filename. If not specified, uses the same name as the source file
1039
+ [--backup/--noBackup] Create backup of existing files before overwriting. Default: false
1040
+ [--recursive/--noRecursive] Recursively search directories for files. Default: false
1041
+ [--filePattern] Regex pattern to match Label Studio files (should match .json files). Default: ".*\.json$"
1042
+ [--copyImages/--noCopyImages] Copy images to output directory when --outDir is specified. Only applies to toLabelStudio and toPPOCR commands. Default: true
1043
+ [--imageBaseDir] Base directory for resolving image paths. Options: "task-file" (relative to task file location), "input-dir" (relative to command execution directory). Default: "task-file"
1044
+ [--sortVertical] Sort bounding boxes vertically. Options: "none", "top-bottom", "bottom-top". Default: "none"
1045
+ [--sortHorizontal] Sort bounding boxes horizontally. Options: "none", "ltr", "rtl". Default: "none"
1046
+ [--normalizeShape] Normalize diamond-like shapes to axis-aligned rectangles. Options: "none", "rectangle". Default: "none"
1047
+ [--useOrientedBox/--noUseOrientedBox] Use oriented (rotated) bounding box when normalizing shapes. Useful for skewed text. Default: false
1048
+ [--widthIncrement] Increase bounding box width by this amount (in pixels). Can be negative to decrease. Default: 0
1049
+ [--heightIncrement] Increase bounding box height by this amount (in pixels). Can be negative to decrease. Default: 0
1050
+ [--adaptResize/--noAdaptResize] Apply adaptive resize to automatically adjust bounding boxes based on image content. Default: false
1051
+ [--adaptResizeThreshold] Grayscale threshold for adaptive resize (0-255). Default: 128
1052
+ [--adaptResizeMargin] Margin pixels around detected content for adaptive resize. Default: 5
1053
+ [--adaptResizeMinComponentSize] Minimum component size in pixels (filters dirt/noise). Default: 10
1054
+ [--adaptResizeMaxComponentSize] Maximum component size in pixels (filters large artifacts). Default: 100000
1055
+ [--adaptResizeOutlierPercentile] Percentile for outlier removal (0-100). Default: 2
1056
+ [--adaptResizeMorphologySize] Morphological operation kernel size. Default: 2
1057
+ [--adaptResizeMaxHorizontalExpansion] Maximum horizontal expansion in pixels (prevents column overlap). Default: 50
1058
+ [--adaptResizePaddingCheckWidth] Width of padding strip to validate (in pixels). Default: 3
1059
+ [--adaptResizeMinPaddingBrightness] Minimum brightness for white padding pixels (0-255). Default: 200
1060
+ [--adaptResizeMinPaddingRatio] Minimum ratio of white pixels in padding strip (0-1). Default: 0.85
1061
+ [--adaptResizeUseAdaptiveThreshold/--noAdaptResizeUseAdaptiveThreshold] Use adaptive thresholding based on image histogram (recommended). Default: true
1062
+ [--adaptResizeAdaptiveBlockSize] Block size for adaptive thresholding. Default: 50
1063
+ [--precision] Number of decimal places for coordinates. Use -1 for full precision (no rounding). Default: 0 (integers)
1064
+ [--outputMode] Output mode: "annotations" for editable annotations (ground truth) or "predictions" for read-only predictions (pre-annotations). Default: "annotations"
1065
+ -h --help Print help information and exit
935
1066
 
936
1067
  ARGUMENTS
937
1068
  args... Input directories containing Label Studio JSON files
@@ -947,27 +1078,71 @@ label-studio-converter enhance-ppocr --help
947
1078
 
948
1079
  ```
949
1080
  USAGE
950
- label-studio-converter enhance-ppocr [--outDir value] [--fileName value] [--backup] [--sortVertical value] [--sortHorizontal value] [--normalizeShape value] [--widthIncrement value] [--heightIncrement value] [--precision value] [--recursive] [--filePattern value] <args>...
1081
+ label-studio-converter enhance-ppocr [--outDir value] [--fileName value] [--backup] [--recursive] [--filePattern value] [--copyImages] [--imageBaseDir value] [--sortVertical value] [--sortHorizontal value] [--normalizeShape value] [--useOrientedBox] [--widthIncrement value] [--heightIncrement value] [--adaptResize] [--adaptResizeThreshold value] [--adaptResizeMargin value] [--adaptResizeMinComponentSize value] [--adaptResizeMaxComponentSize value] [--adaptResizeOutlierPercentile value] [--adaptResizeMorphologySize value] [--adaptResizeMaxHorizontalExpansion value] [--adaptResizePaddingCheckWidth value] [--adaptResizeMinPaddingBrightness value] [--adaptResizeMinPaddingRatio value] [--adaptResizeUseAdaptiveThreshold] [--adaptResizeAdaptiveBlockSize value] [--precision value] <args>...
951
1082
  label-studio-converter enhance-ppocr --help
952
1083
 
953
1084
  Enhance PPOCRLabel files with sorting, normalization, and resizing
954
1085
 
955
1086
  FLAGS
956
- [--outDir] Output directory. If not specified, files are saved in the same directory as the source files
957
- [--fileName] Custom output filename. If not specified, uses the same name as the source file
958
- [--backup/--noBackup] Create backup of existing files before overwriting. Default: false
959
- [--sortVertical] Sort bounding boxes vertically. Options: "none", "top-bottom", "bottom-top". Default: "none"
960
- [--sortHorizontal] Sort bounding boxes horizontally. Options: "none", "ltr", "rtl". Default: "none"
961
- [--normalizeShape] Normalize diamond-like shapes to axis-aligned rectangles. Options: "none", "rectangle". Default: "none"
962
- [--widthIncrement] Increase bounding box width by this amount (in pixels). Can be negative to decrease. Default: 0
963
- [--heightIncrement] Increase bounding box height by this amount (in pixels). Can be negative to decrease. Default: 0
964
- [--precision] Number of decimal places for coordinates. Use -1 for full precision (no rounding). Default: 0 (integers)
1087
+ [--outDir] Output directory. If not specified, files are saved in the same directory as the source files
1088
+ [--fileName] Custom output filename. If not specified, uses the same name as the source file
1089
+ [--backup/--noBackup] Create backup of existing files before overwriting. Default: false
1090
+ [--recursive/--noRecursive] Recursively search directories for files. Default: false
1091
+ [--filePattern] Regex pattern to match PPOCRLabel files (should match .txt files). Default: ".*\.txt$"
1092
+ [--copyImages/--noCopyImages] Copy images to output directory when --outDir is specified. Only applies to toLabelStudio and toPPOCR commands. Default: true
1093
+ [--imageBaseDir] Base directory for resolving image paths. Options: "task-file" (relative to task file location), "input-dir" (relative to command execution directory). Default: "task-file"
1094
+ [--sortVertical] Sort bounding boxes vertically. Options: "none", "top-bottom", "bottom-top". Default: "none"
1095
+ [--sortHorizontal] Sort bounding boxes horizontally. Options: "none", "ltr", "rtl". Default: "none"
1096
+ [--normalizeShape] Normalize diamond-like shapes to axis-aligned rectangles. Options: "none", "rectangle". Default: "none"
1097
+ [--useOrientedBox/--noUseOrientedBox] Use oriented (rotated) bounding box when normalizing shapes. Useful for skewed text. Default: false
1098
+ [--widthIncrement] Increase bounding box width by this amount (in pixels). Can be negative to decrease. Default: 0
1099
+ [--heightIncrement] Increase bounding box height by this amount (in pixels). Can be negative to decrease. Default: 0
1100
+ [--adaptResize/--noAdaptResize] Apply adaptive resize to automatically adjust bounding boxes based on image content. Default: false
1101
+ [--adaptResizeThreshold] Grayscale threshold for adaptive resize (0-255). Default: 128
1102
+ [--adaptResizeMargin] Margin pixels around detected content for adaptive resize. Default: 5
1103
+ [--adaptResizeMinComponentSize] Minimum component size in pixels (filters dirt/noise). Default: 10
1104
+ [--adaptResizeMaxComponentSize] Maximum component size in pixels (filters large artifacts). Default: 100000
1105
+ [--adaptResizeOutlierPercentile] Percentile for outlier removal (0-100). Default: 2
1106
+ [--adaptResizeMorphologySize] Morphological operation kernel size. Default: 2
1107
+ [--adaptResizeMaxHorizontalExpansion] Maximum horizontal expansion in pixels (prevents column overlap). Default: 50
1108
+ [--adaptResizePaddingCheckWidth] Width of padding strip to validate (in pixels). Default: 3
1109
+ [--adaptResizeMinPaddingBrightness] Minimum brightness for white padding pixels (0-255). Default: 200
1110
+ [--adaptResizeMinPaddingRatio] Minimum ratio of white pixels in padding strip (0-1). Default: 0.85
1111
+ [--adaptResizeUseAdaptiveThreshold/--noAdaptResizeUseAdaptiveThreshold] Use adaptive thresholding based on image histogram (recommended). Default: true
1112
+ [--adaptResizeAdaptiveBlockSize] Block size for adaptive thresholding. Default: 50
1113
+ [--precision] Number of decimal places for coordinates. Use -1 for full precision (no rounding). Default: 0 (integers)
1114
+ -h --help Print help information and exit
1115
+
1116
+ ARGUMENTS
1117
+ args... Input directories containing PPOCRLabel files
1118
+ ```
1119
+
1120
+ ##### label-studio-output-to-ppocr Command
1121
+
1122
+ ```bash
1123
+ label-studio-converter label-studio-output-to-ppocr --help
1124
+ ```
1125
+
1126
+ **Output:**
1127
+
1128
+ ```
1129
+ USAGE
1130
+ label-studio-converter label-studio-output-to-ppocr [--recursive] [--backup] [--filePattern value] (--outDir value) [--fileName value] [--removeBaseImageDir value] <args>...
1131
+ label-studio-converter label-studio-output-to-ppocr --help
1132
+
1133
+ Convert Label Studio output files to PPOCRLabel format
1134
+
1135
+ FLAGS
965
1136
  [--recursive/--noRecursive] Recursively search directories for files. Default: false
966
- [--filePattern] Regex pattern to match PPOCRLabel files (should match .txt files). Default: ".*\.txt$"
1137
+ [--backup/--noBackup] Create backup of existing files before overwriting. Default: false
1138
+ [--filePattern] Regex pattern to match input files
1139
+ --outDir Output directory.
1140
+ [--fileName] Output PPOCR file name. Default: "Label.txt"
1141
+ [--removeBaseImageDir] Remove base image directory from image paths in output. Default: "/data/local-files/?d="
967
1142
  -h --help Print help information and exit
968
1143
 
969
1144
  ARGUMENTS
970
- args... Input directories containing PPOCRLabel files
1145
+ args... Input directories containing Label Studio files
971
1146
  ```
972
1147
 
973
1148
  #### Examples
@@ -1030,6 +1205,16 @@ label-studio-converter toLabelStudio ./dataset \
1030
1205
  label-studio-converter toPPOCR ./data \
1031
1206
  --outDir ./output \
1032
1207
  --fileName MyLabels.txt
1208
+
1209
+ # Using imageBaseDir for flexible path resolution
1210
+ # Default: resolve from task file location
1211
+ label-studio-converter toLabelStudio ./annotations/
1212
+
1213
+ # Copy images maintaining full directory structure from execution directory
1214
+ label-studio-converter toLabelStudio ./annotations/ \
1215
+ --copyImages \
1216
+ --imageBaseDir input-dir \
1217
+ --outDir ./output
1033
1218
  ```
1034
1219
 
1035
1220
  ##### Shape Normalization