Self-Correction-Human-Parsing icon indicating copy to clipboard operation
Self-Correction-Human-Parsing copied to clipboard

feat: input files check (filter the unreadable files)

Open abc123yuanrui opened this issue 5 years ago • 1 comments

fix the issue #37

abc123yuanrui avatar Jul 23 '20 00:07 abc123yuanrui

@abc123yuanrui @PeikeLi Do you think we can achieve this in an easier way by simple filtering; by replacing

https://github.com/PeikeLi/Self-Correction-Human-Parsing/blob/ee5877816acd8cd23be68d8da5661d0931b17427/datasets/simple_extractor_dataset.py#L30

with:

allowed_image_extensions = [".png", ".jpg", ".jpeg", ".webm"]

self.file_list = list(
    filter(
        lambda f: sum(
            [f.lower().endswith(ext) for ext in allowed_image_extensions]
        )
        > 0,
        os.listdir(self.root),
    )
)

allowed_image_extensions can be a constructor parameter - that way users may choose what files to filter for.

jutanke avatar Mar 17 '21 08:03 jutanke