Browse Source

compatible with python3

tags/v0.5-sensible
kkkim 7 years ago
parent
commit
3657faa78d
6 changed files with 13 additions and 13 deletions
  1. +3
    -3
      README.md
  2. +3
    -3
      dface/prepare_data/gen_Onet_train_data.py
  3. +2
    -2
      dface/prepare_data/gen_landmark_12.py
  4. +2
    -2
      dface/prepare_data/gen_landmark_24.py
  5. +2
    -2
      dface/prepare_data/gen_landmark_48.py
  6. +1
    -1
      dface/prepare_data/gen_landmark_net_48.py

+ 3
- 3
README.md View File

@@ -91,7 +91,7 @@ mkdir {your dface traindata folder}
* 生成PNet训练数据和标注文件

```shell
python dface/prepare_data/gen_Pnet_train_data.py --prefix_path {注解文件中图片的目录前缀} --dface_traindata_store {之前创建的dface训练数据临时目录} --anno_file {wider face 注解文件,可以不填,默认使用anno_store/wider_origin_anno.txt}
python dface/prepare_data/gen_Pnet_train_data.py --prefix_path {注解文件中图片的目录前缀,就是wider face图片所在目录} --dface_traindata_store {之前创建的dface训练数据临时目录} --anno_file {wider face 注解文件,可以不填,默认使用anno_store/wider_origin_anno.txt}
```
* 乱序合并标注文件

@@ -108,7 +108,7 @@ python dface/train_net/train_p_net.py
* 生成RNet训练数据和标注文件

```shell
python dface/prepare_data/gen_Rnet_train_data.py --dface_traindata_store {之前创建的dface训练数据临时目录} --anno_file {wider face 注解文件,可以不填,默认使用anno_store/wider_origin_anno.txt} --pmodel_file {之前训练的Pnet模型文件}
python dface/prepare_data/gen_Rnet_train_data.py --prefix_path {注解文件中图片的目录前缀,就是wider face图片所在目录} --dface_traindata_store {之前创建的dface训练数据临时目录} --anno_file {wider face 注解文件,可以不填,默认使用anno_store/wider_origin_anno.txt} --pmodel_file {之前训练的Pnet模型文件}
```
* 乱序合并标注文件

@@ -125,7 +125,7 @@ python dface/train_net/train_r_net.py
* 生成ONet训练数据和标注文件

```shell
python dface/prepare_data/gen_Onet_train_data.py --dface_traindata_store {之前创建的dface训练数据临时目录} --anno_file {wider face 注解文件,可以不填,默认使用anno_store/wider_origin_anno.txt} --pmodel_file {之前训练的Pnet模型文件} --rmodel_file {之前训练的Rnet模型文件}
python dface/prepare_data/gen_Onet_train_data.py --prefix_path {注解文件中图片的目录前缀,就是wider face图片所在目录} --dface_traindata_store {之前创建的dface训练数据临时目录} --anno_file {wider face 注解文件,可以不填,默认使用anno_store/wider_origin_anno.txt} --pmodel_file {之前训练的Pnet模型文件} --rmodel_file {之前训练的Rnet模型文件}
```

* 生成ONet的人脸五官关键点训练数据和标注文件


+ 3
- 3
dface/prepare_data/gen_Onet_train_data.py View File

@@ -59,14 +59,14 @@ def gen_onet_data(data_dir, anno_file, pnet_model_file, rnet_model_file, prefix_
cPickle.dump(all_boxes, f, cPickle.HIGHEST_PROTOCOL)


gen_onet_sample_data(data_dir,anno_file,save_file)
gen_onet_sample_data(data_dir,anno_file,save_file,prefix_path)






def gen_onet_sample_data(data_dir,anno_file,det_boxs_file):
def gen_onet_sample_data(data_dir,anno_file,det_boxs_file,prefix):

neg_save_dir = os.path.join(data_dir, "48/negative")
pos_save_dir = os.path.join(data_dir, "48/positive")
@@ -93,7 +93,7 @@ def gen_onet_sample_data(data_dir,anno_file,det_boxs_file):

for annotation in annotations:
annotation = annotation.strip().split(' ')
im_idx = annotation[0]
im_idx = os.path.join(prefix,annotation[0])

boxes = map(float, annotation[1:])
boxes = np.array(boxes, dtype=np.float32).reshape(-1, 4)


+ 2
- 2
dface/prepare_data/gen_landmark_12.py View File

@@ -137,9 +137,9 @@ def parse_args():
parser = argparse.ArgumentParser(description='Test mtcnn',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)

parser.add_argument('--dface_traindata_store', dest='traindata_store', help='dataset folder',
parser.add_argument('--dface_traindata_store', dest='traindata_store', help='dface train data temporary folder,include 12,24,48/postive,negative,part,landmark',
default='../data/wider/', type=str)
parser.add_argument('--anno_file', dest='annotation_file', help='dataset original annotation file',
parser.add_argument('--anno_file', dest='annotation_file', help='celeba dataset original annotation file',
default='../data/wider/anno.txt', type=str)
parser.add_argument('--prefix_path', dest='prefix_path', help='annotation file image prefix root path',
default='../data/', type=str)


+ 2
- 2
dface/prepare_data/gen_landmark_24.py View File

@@ -135,9 +135,9 @@ def parse_args():
parser = argparse.ArgumentParser(description='Test mtcnn',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)

parser.add_argument('--dface_traindata_store', dest='traindata_store', help='dataset folder',
parser.add_argument('--dface_traindata_store', dest='traindata_store', help='dface train data temporary folder,include 12,24,48/postive,negative,part,landmark',
default='/idata/data/wider/', type=str)
parser.add_argument('--anno_file', dest='annotation_file', help='dataset original annotation file',
parser.add_argument('--anno_file', dest='annotation_file', help='celeba dataset original annotation file',
default='/idata/data/trainImageList.txt', type=str)
parser.add_argument('--prefix_path', dest='prefix_path', help='annotation file image prefix root path',
default='/idata/data', type=str)


+ 2
- 2
dface/prepare_data/gen_landmark_48.py View File

@@ -134,9 +134,9 @@ def parse_args():
parser = argparse.ArgumentParser(description='Test mtcnn',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)

parser.add_argument('--dface_traindata_store', dest='traindata_store', help='dataset folder',
parser.add_argument('--dface_traindata_store', dest='traindata_store', help='dface train data temporary folder,include 12,24,48/postive,negative,part,landmark',
default='/idata/data/wider/', type=str)
parser.add_argument('--anno_file', dest='annotation_file', help='dataset original annotation file',
parser.add_argument('--anno_file', dest='annotation_file', help='celeba dataset original annotation file',
default='/idata/data/trainImageList.txt', type=str)
parser.add_argument('--prefix_path', dest='prefix_path', help='annotation file image prefix root path',
default='/idata/data', type=str)


+ 1
- 1
dface/prepare_data/gen_landmark_net_48.py View File

@@ -210,7 +210,7 @@ def parse_args():

parser.add_argument('--dface_traindata_store', dest='traindata_store', help='dataset folder',
default='../data/wider/', type=str)
parser.add_argument('--anno_file', dest='annotation_file', help='output data folder',
parser.add_argument('--anno_file', dest='annotation_file', help='celeba dataset annotation file',
default='../data/wider/anno.txt', type=str)
parser.add_argument('--pmodel_file', dest='pnet_model_file', help='PNet model file path',
default='/idata/workspace/mtcnn/model_store/pnet_epoch_5best.pt', type=str)


Loading…
Cancel
Save