Coder Social home page Coder Social logo

image-classification-level1-35's Introduction

Mask image classification task

Team: 7Features (level1-35)

Contents

  1. Requirements
  2. Project files
  3. Preprocessing
  4. Train

Requirements

torch == 1.9.0+cu102
torchvision == 0.10.0+cu102
timm == 0.42.12
albumentations == 1.0.3
sklearn == 0.24.2
cv2 == 4.5.3
PIL == 8.1.0
pandas_streaming == 0.2.175
numpy == 1.19.2
pandas == 1.1.5
facenet_pytorch
retina-face

Project files

  • main.py
  • train.py - function for train
  • preprocessing.py - make cropped image wtih facenet, retina-face
  • dataset.py - class and function for data load
  • model.py - models for training
  • optimizer.py - optimizer for training
  • Loss.py - loss for training
  • utill.py - Defining functions necessary for the overall process
  • config.ini - Setting the necessary parameters for the overall learning process

Preprocessing

  • Using facenet and retina-face
  • Crop only the human face
# Change values to suit your situation.
train_path = '/opt/ml/input/data/eval/info.csv'
img_path = '/opt/ml/input/data/eval/images' 
train_data = True
PATH = '/opt/ml/input/data/train/cropped_images' if train_data else '/opt/ml/input/data/eval/cropped_images'

# Execution
python preprocessing.py

Train

  1. config.ini setting
[augmentation]
; augmentation do or not
augmentation = 0
; augmentation data use or not
load_augmentation = 0
; # of augmentation
aug_num = 4
; target class of augmentation
aug_targets = [8, 11, 14, 17]

; path setting
[path]
train_csv_path = ../../input/data/train/train.csv
train_images_path = ../../input/data/train/cropped_images
model_save_path = ../../ ; Create a "models" folder in that location
result_save_path = ../../ ; Create a "results" folder in that location
save_name = ;<model name>

; wandb setting
[wandb]
wandb_group_name = ;<group name>
wandb_name = ;<run name>
wandb_entity = ;<userid>
wandb_project_name = ;<projectname>

[training]
optimizer = AdamW
scheduler = CosineAnnealingLR
loss = Crossentropy_focal_labelsmoothing
loss1_weight = 0.9
loss2_weight = 0.1
loss3_weight = 0.3
model_name = swsl_resnext50_32x4d
early_stopping = 5
k_fold_num = 5
epoches = 100
lr = 1e-4
batch_size = 32
prediction_type = Age ; Mask, Age, Gender, All
;(E.g. prediction_type: Age -> A model that judges Age [<30, 30<=&<60, 60<=])
learning_type = All ; Mask, None, All 
;(E.g. prediction_type: Age, learning_type: Mask -> A model that judges only the image with a mask in Age)
num_classes = 3 ; # of discriminant classes according to model
  1. main execution
  • -c is mandatory
main.py -c <config file path>
E.g. main.py -c config.ini

Inference

  • -m : your models location
  • -d : info.csv location
  • -s : save location (Basically, current folder, name is results)
  • -t is option: None or Fold
inference.py -m <model path> -d <file path> -s <save path> -t <inference_type>

image-classification-level1-35's People

Contributors

amber-chaeeunk avatar kyunghyunlim avatar redix8 avatar surfing2003 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.