boostcampaitech3 / level2-semantic-segmentation-level2-cv-17

[2022.04.25 ~ 2022.05.12] Recycle Trash Semantic Segmentation Competition - 부스트캠프 AI Tech 3기
4 stars 2 forks source link

[feat] Cross validation #17

Closed Dongwoo-Im closed 2 years ago

Dongwoo-Im commented 2 years ago

What is this PR?

Cross validation 적용을 위한 PR입니다.

Changes

aistages의 토론게시판 참고하여 작성하였습니다. ref : https://stages.ai/competitions/191/discussion/talk/post/1330

To reviewers

Dongwoo-Im commented 2 years ago

stratified_5fold.py class별 category_id 수 image

stratified_5fold_group.py class별 category_id 수 image

확인 코드 (jupyter)

for mode in ['train', 'val']:
    for i in range(5):
        with open(f'/opt/ml/input/data/stratified_5fold/{mode}_fold{i}.json', "r") as file:
            data = json.load(file)

        output = []
        annot_list = [ann['category_id'] for ann in data['annotations']]
        for cls in range(1, 11):
            output.append(annot_list.count(cls))

        if mode=='train' and i==0:
            df = pd.DataFrame({f"{mode}_fold{i}": output})
        else:
            df = pd.concat([df, pd.DataFrame({f"{mode}_fold{i}": output})], axis=1)
df