Skip to content

Commit

Permalink
effnetb2-b5 test
Browse files Browse the repository at this point in the history
  • Loading branch information
zyxwvu321 committed Jun 4, 2020
1 parent 93d07bd commit 4e34f7b
Show file tree
Hide file tree
Showing 7 changed files with 253 additions and 0 deletions.
30 changes: 30 additions & 0 deletions configs/effb2_meta_default20_extrameta_w_d.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
MODEL:

BACKBONE: 'effnetb2'
NAME: 'effb2_SVMeta'

IMG_FCS: [2816,512]

DATASETS:
ROOT_DIR: ['../data/all18_coloradj','../data/all20_coloradj']
DICT_LABEL: ['NV', 'MEL']
INFO_CSV: ['./dat/all18_info1_convert20.csv','./dat/all20_info1.csv']
NUM_CLASS: 2
DATALOADER:
BATCH_SIZE: 16
SAMPLER: 'weighted_meta'
NUM_WORKERS: 8
TEST:
BATCH_SIZE: 32

MISC:
OUT_DIR: "../checkpoint/effb2_meta_default20_d"
VALID_EPOCH: 10
LOG_PERIOD: 10000

INPUT:
SIZE_TRAIN_IN: [260,260]
CRP_SCALE: [0.1,1.0]
CRP_RATIO: [0.75,1.33]
SOLVER:
EPOCHS: 50
29 changes: 29 additions & 0 deletions configs/effb2_meta_default20_extrameta_w_d_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
MODEL:

BACKBONE: 'effnetb2'
NAME: 'effb2_SVMeta'

IMG_FCS: [2816,512]
DATASETS:
ROOT_DIR: ['../data/all20_usp_coloradj']
DICT_LABEL: ['NV', 'MEL']
INFO_CSV: ['./dat/all20_info_usp.csv']
NUM_CLASS: 2
DATALOADER:
BATCH_SIZE: 16
SAMPLER: 'weighted_meta'
NUM_WORKERS: 8
TEST:
BATCH_SIZE: 32

MISC:
OUT_DIR: "../checkpoint/effb2_meta_default20_d"
VALID_EPOCH: 10
LOG_PERIOD: 10000

INPUT:
SIZE_TRAIN_IN: [260,260]
CRP_SCALE: [0.1,1.0]
CRP_RATIO: [0.75,1.33]
SOLVER:
EPOCHS: 50
30 changes: 30 additions & 0 deletions configs/effb3_meta_default20_extrameta_w_d.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
MODEL:

BACKBONE: 'effnetb3'
NAME: 'effb3_SVMeta'

IMG_FCS: [3072,512]

DATASETS:
ROOT_DIR: ['../data/all18_coloradj','../data/all20_coloradj']
DICT_LABEL: ['NV', 'MEL']
INFO_CSV: ['./dat/all18_info1_convert20.csv','./dat/all20_info1.csv']
NUM_CLASS: 2
DATALOADER:
BATCH_SIZE: 16
SAMPLER: 'weighted_meta'
NUM_WORKERS: 8
TEST:
BATCH_SIZE: 32

MISC:
OUT_DIR: "../checkpoint/effb3_meta_default20_d"
VALID_EPOCH: 10
LOG_PERIOD: 10000

INPUT:
SIZE_TRAIN_IN: [300,300]
CRP_SCALE: [0.1,1.0]
CRP_RATIO: [0.75,1.33]
SOLVER:
EPOCHS: 50
29 changes: 29 additions & 0 deletions configs/effb3_meta_default20_extrameta_w_d_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
MODEL:

BACKBONE: 'effnetb3'
NAME: 'effb3_SVMeta'

IMG_FCS: [3072,512]
DATASETS:
ROOT_DIR: ['../data/all20_usp_coloradj']
DICT_LABEL: ['NV', 'MEL']
INFO_CSV: ['./dat/all20_info_usp.csv']
NUM_CLASS: 2
DATALOADER:
BATCH_SIZE: 16
SAMPLER: 'weighted_meta'
NUM_WORKERS: 8
TEST:
BATCH_SIZE: 32

MISC:
OUT_DIR: "../checkpoint/effb3_meta_default20_d"
VALID_EPOCH: 10
LOG_PERIOD: 10000

INPUT:
SIZE_TRAIN_IN: [300,300]
CRP_SCALE: [0.1,1.0]
CRP_RATIO: [0.75,1.33]
SOLVER:
EPOCHS: 50
30 changes: 30 additions & 0 deletions configs/effb5_meta_default20_extrameta_w_d.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
MODEL:

BACKBONE: 'effnetb5'
NAME: 'effb5_SVMeta'

IMG_FCS: [4096,512]

DATASETS:
ROOT_DIR: ['../data/all18_coloradj','../data/all20_coloradj']
DICT_LABEL: ['NV', 'MEL']
INFO_CSV: ['./dat/all18_info1_convert20.csv','./dat/all20_info1.csv']
NUM_CLASS: 2
DATALOADER:
BATCH_SIZE: 8
SAMPLER: 'weighted_meta'
NUM_WORKERS: 8
TEST:
BATCH_SIZE: 32

MISC:
OUT_DIR: "../checkpoint/effb5_meta_default20_d"
VALID_EPOCH: 10
LOG_PERIOD: 10000

INPUT:
SIZE_TRAIN_IN: [456,456]
CRP_SCALE: [0.1,1.0]
CRP_RATIO: [0.75,1.33]
SOLVER:
EPOCHS: 50
29 changes: 29 additions & 0 deletions configs/effb5_meta_default20_extrameta_w_d_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
MODEL:

BACKBONE: 'effnetb5'
NAME: 'effb5_SVMeta'

IMG_FCS: [4096,512]
DATASETS:
ROOT_DIR: ['../data/all20_usp_coloradj']
DICT_LABEL: ['NV', 'MEL']
INFO_CSV: ['./dat/all20_info_usp.csv']
NUM_CLASS: 2
DATALOADER:
BATCH_SIZE: 8
SAMPLER: 'weighted_meta'
NUM_WORKERS: 8
TEST:
BATCH_SIZE: 32

MISC:
OUT_DIR: "../checkpoint/effb5_meta_default20_d"
VALID_EPOCH: 10
LOG_PERIOD: 10000

INPUT:
SIZE_TRAIN_IN: [456,456]
CRP_SCALE: [0.1,1.0]
CRP_RATIO: [0.75,1.33]
SOLVER:
EPOCHS: 50
76 changes: 76 additions & 0 deletions convert_18csv_to20_single.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# -*- coding: utf-8 -*-
"""
Created on Sat May 30 18:01:58 2020
use 18 pred result to generate 20 submit table
@author: cmj
"""
import pandas as pd
import numpy as np


label18 = ['MEL', 'NV', 'BCC', 'AKIEC', 'BKL', 'DF', 'VASC']

map_18 = [1,0,1, 1,0,0,0]



fn_csv_pred = '../checkpoint/18pred_fl.csv'
fn_csv_out= '../checkpoint/20pred_fl_convert_mc.csv'

meta_fn = '../data/ISIC20/test.csv'


pred_18 = pd.read_csv(fn_csv_pred).values

meta_20 = pd.read_csv(meta_fn).values


dict_p = dict()
dict_pn = dict()


for pp in pred_18:
img_fn = pp[0]
pred = pp[1:].astype('float32')

idx = np.where(meta_20[:,0]==img_fn)[0][0]
pid = meta_20[idx,1]

if pid in dict_p.keys():

dict_p[pid] += pred
dict_pn[pid] +=1
else:
dict_p[pid] = pred
dict_pn[pid] =1




dict_label = [ 'target']
fn_list = meta_20[:,0]
targets = list()
for meta,preds in zip(meta_20,pred_18):
fn = meta[0]
pid = meta[1]

pred = preds[1:]
p1 = pred[0]+pred[2]+pred[3]
p0 = 1-p1

# p1 = pred[0]
# p0 = pred[1]
# p1 = p1/(p1+p0)

#pos = np.argmax(pred)
#val = map_18[pos]
targets.append(p1)




df = pd.DataFrame(data = targets,index =fn_list, columns = dict_label)



df.to_csv(fn_csv_out,index_label = 'image_name')

0 comments on commit 4e34f7b

Please sign in to comment.