Skip to content

Commit c2d46b1

Browse files
author
Yang Liu
committed
update
1 parent 4a80f7a commit c2d46b1

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Download [ResNet-152](https://drive.google.com/file/d/0Byy2AcGyEVxfeXExMzNNOHpEO
3535
### Data Pre-processing
3636
Extract 8,144 training images, and split them by 80:20 rule (6,515 for training, 1,629 for validation):
3737
```bash
38-
$ python pre-process.py
38+
$ python pre_process.py
3939
```
4040

4141
### Train

README.template

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Download [ResNet-152](https://drive.google.com/file/d/0Byy2AcGyEVxfeXExMzNNOHpEO
3535
### Data Pre-processing
3636
Extract 8,144 training images, and split them by 80:20 rule (6,515 for training, 1,629 for validation):
3737
```bash
38-
$ python pre-process.py
38+
$ python pre_process.py
3939
```
4040

4141
### Train

pre-process.py pre_process.py

+9-13
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
# -*- coding: utf-8 -*-
22

3-
import tarfile
4-
import scipy.io
5-
import numpy as np
63
import os
7-
import cv2 as cv
8-
import shutil
94
import random
10-
from console_progressbar import ProgressBar
5+
import shutil
6+
import tarfile
7+
8+
import cv2 as cv
9+
import numpy as np
10+
import scipy.io
11+
from tqdm import tqdm
1112

1213

1314
def ensure_folder(folder):
@@ -23,9 +24,7 @@ def save_train_data(fnames, labels, bboxes):
2324
num_train = int(round(num_samples * train_split))
2425
train_indexes = random.sample(range(num_samples), num_train)
2526

26-
pb = ProgressBar(total=100, prefix='Save train data', suffix='', decimals=3, length=50, fill='=')
27-
28-
for i in range(num_samples):
27+
for i in tqdm(range(num_samples)):
2928
fname = fnames[i]
3029
label = labels[i]
3130
(x1, y1, x2, y2) = bboxes[i]
@@ -40,7 +39,6 @@ def save_train_data(fnames, labels, bboxes):
4039
x2 = min(x2 + margin, width)
4140
y2 = min(y2 + margin, height)
4241
# print("{} -> {}".format(fname, label))
43-
pb.print_progress_bar((i + 1) * 100 / num_samples)
4442

4543
if i in train_indexes:
4644
dst_folder = 'data/train'
@@ -62,9 +60,7 @@ def save_test_data(fnames, bboxes):
6260
dst_folder = 'data/test'
6361
num_samples = len(fnames)
6462

65-
pb = ProgressBar(total=100, prefix='Save test data', suffix='', decimals=3, length=50, fill='=')
66-
67-
for i in range(num_samples):
63+
for i in tqdm(range(num_samples)):
6864
fname = fnames[i]
6965
(x1, y1, x2, y2) = bboxes[i]
7066
src_path = os.path.join(src_folder, fname)

0 commit comments

Comments
 (0)