diff --git a/.gitignore b/.gitignore
index e077108..10f08b3 100755
--- a/.gitignore
+++ b/.gitignore
@@ -2,16 +2,13 @@
*/.ipynb_checkpoints/*
*.t7
*.jpg
-*.png
*.txt
!requirements.txt
*.pyc
-models
results
__pycache__
others
.vscode
-.pycocotools
.idea
pretrained
*.pth
diff --git a/README.md b/README.md
index d0ea448..5f71858 100755
--- a/README.md
+++ b/README.md
@@ -7,22 +7,27 @@ Some codes for networks and display are brought from:
2. [Vanilla FCN, U-Net, SegNet, PSPNet, GCN, DUC](https://github.com/zijundeng/pytorch-semantic-segmentation)
3. [Shufflenet-v2-Pytorch](https://github.com/ericsun99/Shufflenet-v2-Pytorch)
4. [tf-pose-estimation](https://github.com/ildoonet/tf-pose-estimation)
-5. [DSNTNN](https://github.com/anibali/dsntnn)
+5. [dsntnn](https://github.com/anibali/dsntnn)
+
+## NEWS!
+
+- Mar 2019: Support running on MacBook with decent FPS!
+- Feb 2019: **ALL** the pretrained model files are avaliable!
## Requirements
-- Python 3.6
+- Python 3.7
- PyTorch 1.0
-- DSNTNN 1.0
+- [dsntnn 1.0](https://github.com/anibali/dsntnn)
## Evaluation Results
-|Model|Parmas(M)|Flops(G)|mAP(IoU=0.5:0.95)|mAP(IoU=0.5)|mAR(IoU=0.5:0.95)|mAR(IoU=0.5)|Google Drive|
-|---|---|---|---|---|---|---|---|
-|ResNet18(224x224)+DUC+DSNTNN|12.26|1.64|**0.682**|0.939|**0.797**|0.967|[50M](https://drive.google.com/open?id=17Z1zetIVDI4_8-ZoFgTRsjHtDpwGtjRT)|
-|MobileNetV2(224x224)+DUC+DSNTNN|3.91|0.49|0.675|**0.949**|0.794|**0.971**|[16M]([https://drive.google.com/open?id=1Meyz8Jg2aRe8ijeBAY1uCRpV9l5OJoXl](https://drive.google.com/open?id=15Ihv1bVQv6_tYTFlECJMNrXEmrrka5g4))|
-|ShuffleNetV2(224x224)+DUC+DSNTNN|2.92|**0.31**|0.615|0.916|0.748|0.955|[12M](https://drive.google.com/open?id=184Zg4E6HbbizPFYcELMXCd7mwWXdUd3U)|
-|SqueezeNet1.1(224x224)+DUC+DSNTNN|**2.22**|0.63|0.584|0.921|0.723|0.958|[9M](https://drive.google.com/open?id=1RePeiBJHeHvmYTQ5vAUJHC5CstHIBcP0)|
+|Model(+DUC+DSNTNN)|Parmas(M)|Flops(G)|AP@0.5:0.95|AP@0.5|AR@0.5:0.95|AR@0.5|Link|
+|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
+|ResNet18|12.26|1.64|**68.2**|93.9|**79.7**|96.7|[51.5M](https://drive.google.com/open?id=17Z1zetIVDI4_8-ZoFgTRsjHtDpwGtjRT)|
+|MobileNetV2|3.91|0.49|67.5|**94.9**|79.4|**97.1**|[16.6M](https://drive.google.com/open?id=15Ihv1bVQv6_tYTFlECJMNrXEmrrka5g4)|
+|ShuffleNetV2|2.92|**0.31**|61.5|91.6|74.8|95.5|[12.4M](https://drive.google.com/open?id=184Zg4E6HbbizPFYcELMXCd7mwWXdUd3U)|
+|SqueezeNet1.1|**2.22**|0.63|58.4|92.1|72.3|95.8|[9.3M](https://drive.google.com/open?id=1RePeiBJHeHvmYTQ5vAUJHC5CstHIBcP0)|

@@ -39,19 +44,23 @@ Some codes for networks and display are brought from:
## Usage
-1. Training:
+1. Installation:
+
+```shell
+pip install -r requirements.txt
+```
+2. Training:
```shell
python training.py --model shufflenetv2 --gpu 0 --inputsize 224 --lr 1e-3 --batchsize 128 --t7 ./models/shufflenetv2_224_adam_best.t7
```
-2. Evaluation
+3. Evaluation
```shell
ln -s cocoapi/PythonAPI/pycocotools
cd cocoapi/PythonAPI && make
python eval.py --t7 ./models/resnet18_224_adam_best.t7 --model resnet18 --gpu 0
```
-
-3. Web Camera Demo
+4. Web Camera Demo (MacBook)
```shell
python run_webcam.py --model squeezenet --inp_dim 224 --camera 0
diff --git a/coco_utils.py b/coco_utils.py
index 20da2ed..8d0a258 100755
--- a/coco_utils.py
+++ b/coco_utils.py
@@ -1,16 +1,17 @@
'''
File: coco_utils.py
-Project: MobilePose
-File Created: Saturday, 3rd March 2018 7:04:57 pm
+Project: MobilePose-PyTorch
+File Created: Thursday, 20th December 2018 6:11:07 pm
Author: Yuliang Xiu (yuliangxiu@sjtu.edu.cn)
-----
-Last Modified: Thursday, 8th March 2018 3:02:15 pm
+Last Modified: Monday, 11th March 2019 12:51:27 am
Modified By: Yuliang Xiu (yuliangxiu@sjtu.edu.cn>)
-----
-Copyright 2018 - 2018 Shanghai Jiao Tong University, Machine Vision and Intelligence Group
+Copyright 2018 - 2019 Shanghai Jiao Tong University, Machine Vision and Intelligence Group
'''
+
# define coco class
import json
import numpy as np
diff --git a/dataloader.py b/dataloader.py
index 79e54b3..8b08b4d 100755
--- a/dataloader.py
+++ b/dataloader.py
@@ -1,15 +1,16 @@
'''
File: dataloader.py
-Project: MobilePose
-File Created: Thursday, 8th March 2018 3:00:27 pm
+Project: MobilePose-PyTorch
+File Created: Tuesday, 15th January 2019 6:26:25 pm
Author: Yuliang Xiu (yuliangxiu@sjtu.edu.cn)
-----
-Last Modified: Thursday, 8th March 2018 3:00:39 pm
+Last Modified: Monday, 11th March 2019 12:51:19 am
Modified By: Yuliang Xiu (yuliangxiu@sjtu.edu.cn>)
-----
-Copyright 2018 - 2018 Shanghai Jiao Tong University, Machine Vision and Intelligence Group
+Copyright 2018 - 2019 Shanghai Jiao Tong University, Machine Vision and Intelligence Group
'''
+
import csv
import numpy as np
import os
@@ -162,14 +163,6 @@ def __call__(self, sample):
# guass_heatmap = sample['guass_heatmap']
h, w = image.shape[:2]
- # x_mean = np.mean(image[:,:,3])
- # x_std = np.std(image[:,:,3])
- # y_mean = np.mean(image[:,:,4])
- # y_std = np.std(image[:,:,4])
-
- # mean=np.array([0.485, 0.456, 0.406, x_mean, y_mean])
- # std=np.array([0.229, 0.224, 0.225, x_std, y_std])
-
mean=np.array([0.485, 0.456, 0.406])
std=np.array([0.229, 0.224, 0.225])
diff --git a/dataset_factory.py b/dataset_factory.py
index 39a1176..1f209b7 100755
--- a/dataset_factory.py
+++ b/dataset_factory.py
@@ -1,3 +1,16 @@
+'''
+File: dataset_factory.py
+Project: MobilePose-PyTorch
+File Created: Sunday, 10th March 2019 8:02:12 pm
+Author: Yuliang Xiu (yuliangxiu@sjtu.edu.cn)
+-----
+Last Modified: Monday, 11th March 2019 12:51:11 am
+Modified By: Yuliang Xiu (yuliangxiu@sjtu.edu.cn>)
+-----
+Copyright 2018 - 2019 Shanghai Jiao Tong University, Machine Vision and Intelligence Group
+'''
+
+
from dataloader import Rescale, Wrap, PoseDataset, ToTensor, Augmentation, Expansion
from torchvision import datasets, transforms, utils, models
import os
@@ -12,14 +25,7 @@ def get_transform(modeltype, input_size):
:param input_size:
:return:
"""
- # if "resnet" in modeltype:
- # return Rescale((input_size, input_size))
- # elif "mobilenet" in modeltype:
- # return Wrap((input_size, input_size))
- # else:
- # raise ValueError("modeltype is not wrong")
return Rescale((input_size, input_size))
- # return Wrap((input_size, input_size))
class DatasetFactory:
diff --git a/demo.png b/demo.png
new file mode 100644
index 0000000..374fbd8
Binary files /dev/null and b/demo.png differ
diff --git a/estimator.py b/estimator.py
index d707cb5..83a9ece 100755
--- a/estimator.py
+++ b/estimator.py
@@ -1,15 +1,16 @@
'''
File: estimator.py
-Project: MobilePose
-File Created: Thursday, 8th March 2018 3:02:01 pm
+Project: MobilePose-PyTorch
+File Created: Monday, 11th March 2019 12:50:16 am
Author: Yuliang Xiu (yuliangxiu@sjtu.edu.cn)
-----
-Last Modified: Thursday, 8th March 2018 3:02:06 pm
+Last Modified: Monday, 11th March 2019 12:50:58 am
Modified By: Yuliang Xiu (yuliangxiu@sjtu.edu.cn>)
-----
-Copyright 2018 - 2018 Shanghai Jiao Tong University, Machine Vision and Intelligence Group
+Copyright 2018 - 2019 Shanghai Jiao Tong University, Machine Vision and Intelligence Group
'''
+
import itertools
import logging
import math
diff --git a/eval.py b/eval.py
index 240972e..327241f 100755
--- a/eval.py
+++ b/eval.py
@@ -1,16 +1,17 @@
# coding: utf-8
'''
File: eval.py
-Project: MobilePose
-File Created: Thursday, 8th March 2018 1:54:07 pm
+Project: MobilePose-PyTorch
+File Created: Thursday, 7th March 2019 1:50:18 pm
Author: Yuliang Xiu (yuliangxiu@sjtu.edu.cn)
-----
-Last Modified: Thursday, 8th March 2018 3:01:51 pm
+Last Modified: Monday, 11th March 2019 12:50:50 am
Modified By: Yuliang Xiu (yuliangxiu@sjtu.edu.cn>)
-----
-Copyright 2018 - 2018 Shanghai Jiao Tong University, Machine Vision and Intelligence Group
+Copyright 2018 - 2019 Shanghai Jiao Tong University, Machine Vision and Intelligence Group
'''
+
import warnings
warnings.filterwarnings('ignore')
diff --git a/network.py b/network.py
index 1bee7b1..78674fa 100755
--- a/network.py
+++ b/network.py
@@ -1,16 +1,17 @@
'''
-File: networks.py
-Project: MobilePose
-File Created: Thursday, 8th March 2018 2:59:28 pm
+File: network.py
+Project: MobilePose-PyTorch
+File Created: Thursday, 7th March 2019 6:33:57 pm
Author: Yuliang Xiu (yuliangxiu@sjtu.edu.cn)
-----
-Last Modified: Thursday, 8th March 2018 3:01:29 pm
+Last Modified: Monday, 11th March 2019 12:50:40 am
Modified By: Yuliang Xiu (yuliangxiu@sjtu.edu.cn>)
-----
-Copyright 2018 - 2018 Shanghai Jiao Tong University, Machine Vision and Intelligence Group
+Copyright 2018 - 2019 Shanghai Jiao Tong University, Machine Vision and Intelligence Group
'''
+
from networks import *
from networks.senet import se_resnet
import torch.nn as nn
diff --git a/requirements.txt b/requirements.txt
index e98003d..69eee6f 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,15 +1,15 @@
-numpy==1.14.5
-matplotlib==3.0.2
-scipy==1.1.0
-Cython==0.29.2
-dsntnn==0.4.0a0
-torch==1.0.0
alog==0.9.13
-tqdm==4.19.9
-imgaug==0.2.7
+torch==1.0.0
+scipy==1.1.0
scikit_image==0.13.1
opencv_python==3.4.2.17
+tqdm==4.19.9
+numpy==1.14.5
torchvision==0.2.1
+Cython==0.29.2
+dsntnn==0.4.0a0
+imgaug==0.2.7
+matplotlib==3.0.2
Pillow==5.4.1
scripts==2.0
skimage==0.0
diff --git a/run_webcam.py b/run_webcam.py
index bfe0102..c589937 100755
--- a/run_webcam.py
+++ b/run_webcam.py
@@ -1,13 +1,13 @@
'''
File: run_webcam.py
-Project: MobilePose
-File Created: Thursday, 8th March 2018 2:19:39 pm
+Project: MobilePose-PyTorch
+File Created: Monday, 11th March 2019 12:47:30 am
Author: Yuliang Xiu (yuliangxiu@sjtu.edu.cn)
-----
-Last Modified: Thursday, 8th March 2018 3:01:35 pm
+Last Modified: Monday, 11th March 2019 12:48:49 am
Modified By: Yuliang Xiu (yuliangxiu@sjtu.edu.cn>)
-----
-Copyright 2018 - 2018 Shanghai Jiao Tong University, Machine Vision and Intelligence Group
+Copyright 2018 - 2019 Shanghai Jiao Tong University, Machine Vision and Intelligence Group
'''
import argparse
@@ -48,7 +48,7 @@
# initial the camera
cam = cv2.VideoCapture(args.camera)
- # ret_val, image = cam.read()
+ ret_val, image = cam.read()
image = crop_camera(image)
while True:
diff --git a/training.py b/training.py
index f257b49..2e48335 100755
--- a/training.py
+++ b/training.py
@@ -1,17 +1,17 @@
# coding: utf-8
-
'''
File: training.py
-Project: MobilePose
-File Created: Thursday, 8th March 2018 2:50:11 pm
+Project: MobilePose-PyTorch
+File Created: Friday, 8th March 2019 6:53:13 pm
Author: Yuliang Xiu (yuliangxiu@sjtu.edu.cn)
-----
-Last Modified: Thursday, 8th March 2018 2:50:51 pm
+Last Modified: Monday, 11th March 2019 12:50:27 am
Modified By: Yuliang Xiu (yuliangxiu@sjtu.edu.cn>)
-----
-Copyright 2018 - 2018 Shanghai Jiao Tong University, Machine Vision and Intelligence Group
+Copyright 2018 - 2019 Shanghai Jiao Tong University, Machine Vision and Intelligence Group
'''
+
# remove warning
import warnings
warnings.filterwarnings('ignore')
diff --git a/utils/joint_transforms.py b/utils/joint_transforms.py
index 9729f72..01fa7c8 100644
--- a/utils/joint_transforms.py
+++ b/utils/joint_transforms.py
@@ -1,3 +1,16 @@
+'''
+File: joint_transforms.py
+Project: MobilePose-PyTorch
+File Created: Monday, 7th January 2019 1:25:58 pm
+Author: Yuliang Xiu (yuliangxiu@sjtu.edu.cn)
+-----
+Last Modified: Monday, 11th March 2019 12:51:40 am
+Modified By: Yuliang Xiu (yuliangxiu@sjtu.edu.cn>)
+-----
+Copyright 2018 - 2019 Shanghai Jiao Tong University, Machine Vision and Intelligence Group
+'''
+
+
import math
import numbers
import random