MCPcopy Index your code
hub / github.com/YBIGTA/pytorch-hair-segmentation

github.com/YBIGTA/pytorch-hair-segmentation @v0.1.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.1.0 ↗ · + Follow
147 symbols 322 edges 13 files 8 documented · 5%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

pytorch-hair-segmentation

Implementation of pytorch semantic segmentation with figaro-1k.

  • tutorial document : https://pytorchhair.gitbook.io/project/ (kor)

Prerequisites

opencv-contrib-python 3.4.4
pytorch 0.4.1
numpy 1.14.5
git-lfs 2.3.4 (to download uploaded model files)

Downloading dataset

# specify a directory for dataset to be downloaded into, else default is ./data/
sh data/figaro.sh #<directory>

Running trainer

# sample execution

python3 main.py \
  --networks mobilenet \
  --dataset figaro \
  --data_dir ./data/Figaro1k \
  --scheduler ReduceLROnPlateau \
  --batch_size 4 \
  --epochs 5 \
  --lr 1e-3 \
  --num_workers 2 \
  --optimizer adam \
  --img_size 256 \
  --momentum 0.5 \
  --ignite True
  • You should add your own model script in networks and make it avaliable in get_network in ./networks/__init__.py

Running docker & train

with ignite

docker run davinnovation/pytorch-hairsegment:cpu python main.py

with no-ignite

docker run -p davinnovation/pytorch-hairsegment:cpu python main.py --ignite False

Evaluating model

# sample execution

python3 evaluate.py \
  --networks pspnet_resnet101 \
  --ckpt_dir ./models/pspnet_resnet101_sgd_lr_0.002_epoch_100_test_iou_0.918.pth \
  --dataset figaro \
  --data_dir ./data/Figaro1k \
  --save_dir ./overlay/ \
  --use_gpu True

Evaluation result on figaro testset

Model IoU F1-score
pspnet_resnet101 0.92 0.96
pspnet_squeezenet 0.88 0.91
deeplabv3plus 0.80 0.89

Sample visualization

  • Red: GT / Blue: Segmentation Map

sample_0 sample_1 sample_2 sample_3 sample_4

Core symbols most depended-on inside this repo

get_loader
called by 5
data/__init__.py
update_state
called by 3
utils/__init__.py
pad_to_target
called by 3
utils/joint_transforms.py
get_optimizer
called by 2
utils/trainer_verbose.py
check_mkdir
called by 2
utils/__init__.py
_pad
called by 2
utils/joint_transforms.py
_pad
called by 2
utils/joint_transforms.py
reset
called by 2
utils/metrics.py

Shape

Method 90
Class 36
Function 21

Languages

Python100%

Modules by API surface

utils/joint_transforms.py37 symbols
networks/deeplab_v3_plus.py23 symbols
networks/mobile_hair.py22 symbols
utils/metrics.py20 symbols
networks/pspnet.py16 symbols
utils/trainer_verbose.py6 symbols
utils/__init__.py6 symbols
data/lfw.py6 symbols
data/figaro.py5 symbols
main.py3 symbols
networks/__init__.py1 symbols
evaluate.py1 symbols

For agents

$ claude mcp add pytorch-hair-segmentation \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page