Skip to content

Commit 21a54a6

Browse files
committed
update readme
1 parent ad30652 commit 21a54a6

4 files changed

Lines changed: 8 additions & 41 deletions

File tree

README.md

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Scene Classification
22

3-
This repository is to do scene classification by fine-tuning ResNet-152 with Cars Dataset from Stanford.
3+
This repository is to do scene classification by fine-tuning ResNet-152 with AI Challenger 2017 Scene Classification Dataset.
44

55

66
## Dependencies
@@ -12,18 +12,12 @@ This repository is to do scene classification by fine-tuning ResNet-152 with Car
1212

1313
## Dataset
1414

15-
We use the Cars Dataset, which contains 16,185 images of 196 classes of cars. The data is split into 8,144 training images and 8,041 testing images, where each class has been split roughly in a 50-50 split.
15+
We use the Scene Classification Dataset from AI Challenger 2017, which contains 60,999 images of 80 classes of scenes. The data is split into 53,879 training images and 7,120 testing images.
1616

17-
![image](https://github.com/foamliu/Scene-Classification/raw/master/images/random.jpg)
17+
![image](https://github.com/foamliu/Scene-Classification/raw/master/images/dataset.png)
1818

19-
You can get it from [Cars Dataset](https://ai.stanford.edu/~jkrause/cars/car_dataset.html):
19+
You can get it from [Scene Classification Dataset](https://challenger.ai/datasets/scene):
2020

21-
```bash
22-
$ cd Scene-Classification
23-
$ wget http://imagenet.stanford.edu/internal/car196/cars_train.tgz
24-
$ wget http://imagenet.stanford.edu/internal/car196/cars_test.tgz
25-
$ wget --no-check-certificate https://ai.stanford.edu/~jkrause/cars/car_devkit.tgz
26-
```
2721

2822
## ImageNet Pretrained Models
2923

@@ -32,7 +26,7 @@ Download [ResNet-152](https://drive.google.com/file/d/0Byy2AcGyEVxfeXExMzNNOHpEO
3226
## Usage
3327

3428
### Data Pre-processing
35-
Extract 8,144 training images, and split them by 80:20 rule (6,515 for training, 1,629 for validation):
29+
Extract 60,999 training images, and split them (53,879 for training, 7,120 for validation):
3630
```bash
3731
$ python pre-process.py
3832
```
@@ -47,33 +41,6 @@ If you want to visualize during training, run in your terminal:
4741
$ tensorboard --logdir path_to_current_dir/logs
4842
```
4943

50-
![image](https://github.com/foamliu/Scene-Classification/raw/master/images/train.jpg)
51-
52-
### Analysis
53-
Update "model_weights_path" in "utils.py" with your best model, and use 1,629 validation images for result analysis:
54-
```bash
55-
$ python analyze.py
56-
```
57-
58-
#### Validation acc:
59-
**88.70%**
60-
61-
#### Confusion matrix:
62-
63-
![image](https://github.com/foamliu/Scene-Classification/raw/master/images/confusion_matrix.jpg)
64-
65-
### Test
66-
```bash
67-
$ python test.py
68-
```
69-
70-
Submit predictions of test data set (8,041 testing images) at [Cars Dataset](https://ai.stanford.edu/~jkrause/cars/car_dataset.html), evaluation result:
71-
72-
#### Test acc:
73-
**88.88%**
74-
75-
![image](https://github.com/foamliu/Scene-Classification/raw/master/images/test.jpg)
76-
7744
### Demo
7845
Download [pre-trained model](https://github.com/foamliu/Scene-Classification/releases/download/v1.0/model.96-0.89.hdf5) into "models" folder then run:
7946

demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
class_id = np.argmax(preds)
5050
print(scene_classes_dict[class_id])
5151
text = ('Predict: {}, prob: {}'.format(scene_classes_dict[class_id], prob))
52-
draw_str(image, (20, 20), text)
52+
draw_str(image, (40, 40), text)
5353
cv.imwrite('images/{}_out.png'.format(i), image)
5454

5555
K.clear_session()

images/dataset.png

375 KB
Loading

utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ def get_available_cpus():
1717

1818
def draw_str(dst, target, s):
1919
x, y = target
20-
cv.putText(dst, s, (x + 1, y + 1), cv.FONT_HERSHEY_PLAIN, 1.0, (0, 0, 0), thickness=2, lineType=cv.LINE_AA)
21-
cv.putText(dst, s, (x, y), cv.FONT_HERSHEY_PLAIN, 1.0, (255, 255, 255), lineType=cv.LINE_AA)
20+
cv.putText(dst, s, (x + 1, y + 1), cv.FONT_HERSHEY_PLAIN, 2.0, (0, 0, 0), thickness=2, lineType=cv.LINE_AA)
21+
cv.putText(dst, s, (x, y), cv.FONT_HERSHEY_PLAIN, 2.0, (255, 255, 255), lineType=cv.LINE_AA)

0 commit comments

Comments
 (0)