Skip to content

Stage 2: Character Detection and Cropping

CyberMeow edited this page Dec 24, 2023 · 7 revisions

Crop independent characters into a separate folder

  • If you start from this stage, please set --src_dir to the folder containing all the images to process (like the .../raw folder from the first stage).
  • Output folder: /path/to/dataset_dir/intermediate/{image_type}/cropped

This stage along with stage 3 allow to identify the characters of each image. Moreover, the cropped images are also included in the dataset unless --no_cropped_in_dataset is specified.

Command line arguments

  • min_crop_size: Minimum size for cropped image (shorter edge). Smaller images are dropped. Default is 320.
    Example usage: --min_crop_size 320
  • crop_with_head: Do not save images without head during cropping.
    Example usage: --crop_with_head
  • crop_with_face: Do not save images without face during cropping (this can be problematic if you want to learn how to draw characters from behind).
    Example usage: --crop_with_face
  • detect_level: The level of detection model used. Options are 'n', 's', 'm', 'x'. The 'n' model is faster with less system overhead. For more information please see https://deepghs.github.io/imgutils/main/api_doc/detect/index.html.
    Example usage: --detect_level n
  • use_3stage_crop: Use 3-stage cropping to additionally get head and half body crops. It can be used at either stage 2 or 4 (if used at stage 4 the cropped images are directly saved to the classified folder).
    Example usage: "--use_3stage_crop 2" or "--use_3stage_crop 4"