Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added results/FA.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added results/FA_precision-recall.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions results/checkpoint
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
model_checkpoint_path: "model_ges.ckpt"
all_model_checkpoint_paths: "model_ges.ckpt"
199 changes: 199 additions & 0 deletions results/data_resize.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 3 15:32:52 2017

@author: nvlab
"""

# -*- coding: utf-8 -*-
"""
Created on Sat Sep 30 12:13:40 2017

@author: nvlab
"""

# -*- coding: utf-8 -*-
"""
Created on Sat Sep 23 15:58:21 2017

@author: nvlab
"""

import numpy as np
from PIL import Image
import scipy.misc

global num_house1_L,num_house2_L,num_house3_L,num_lab1_L,num_lab2_L,num_lab3_L,num_lab4_L
global num_house1_R,num_house2_R,num_house3_R,num_lab1_R,num_lab2_R,num_lab3_R,num_lab4_R
global num_off1_R, num_off2_R, num_off3_R, num_off1_L, num_off2_L, num_off3_L
global img_path
num_house1_L = 1
num_off1_L = 1
num_off1_R = 1
num_house2_L = 1
num_off2_L = 1
num_off2_R = 1
num_house3_L = 1
num_off3_L = 1
num_off3_R = 1
num_lab1_L = 1
num_lab2_L = 1
num_lab3_L = 1
num_lab4_L = 1
num_house1_R = 1
num_house2_R = 1
num_house3_R = 1
num_lab1_R = 1
num_lab2_R = 1
num_lab3_R = 1
num_lab4_R = 1
def read_data(batch):

global num_house1_L,num_house2_L,num_house3_L,num_lab1_L,num_lab2_L,num_lab3_L,num_lab4_L
global num_house1_R,num_house2_R,num_house3_R,num_lab1_R,num_lab2_R,num_lab3_R,num_lab4_R
global num_off1_R, num_off2_R, num_off3_R, num_off1_L, num_off2_L, num_off3_L
global img_path
for i in range(batch):
if num_house1_L<=831:
img_path = "../../../../Disk2/cedl/handcam/frames/train/house/1/Lhand/Image%s.png"%(num_house1_L)
num_house1_L+=1
elif num_house1_R<=831:
img_path = "../../../../Disk2/cedl/handcam/frames/train/house/1/Rhand/Image%s.png"%(num_house1_R)
num_house1_R+=1
elif num_house2_L<=988:
img_path = "../../../../Disk2/cedl/handcam/frames/train/house/2/Lhand/Image%s.png"%(num_house2_L)
num_house2_L+=1
elif num_house2_R<=988:
img_path = "../../../../Disk2/cedl/handcam/frames/train/house/2/Rhand/Image%s.png"%(num_house2_R)
num_house2_R+=1
elif num_house3_L<=1229:
img_path = "../../../../Disk2/cedl/handcam/frames/train/house/3/Lhand/Image%s.png"%(num_house3_L)
num_house3_L+=1
elif num_house3_R<=1229:
img_path = "../../../../Disk2/cedl/handcam/frames/train/house/3/Rhand/Image%s.png"%(num_house3_R)
num_house3_R+=1
elif num_lab1_L<=501:
img_path = "../../../../Disk2/cedl/handcam/frames/train/lab/1/Lhand/Image%s.png"%(num_lab1_L)
num_lab1_L+=1
elif num_lab1_R<=501:
img_path = "../../../../Disk2/cedl/handcam/frames/train/lab/1/Rhand/Image%s.png"%(num_lab1_R)
num_lab1_R+=1
elif num_lab2_L<=589:
img_path = "../../../../Disk2/cedl/handcam/frames/train/lab/2/Lhand/Image%s.png"%(num_lab2_L)
num_lab2_L+=1
elif num_lab2_R<=589:
img_path = "../../../../Disk2/cedl/handcam/frames/train/lab/2/Rhand/Image%s.png"%(num_lab2_R)
num_lab2_R+=1
elif num_lab3_L<=730:
img_path = "../../../../Disk2/cedl/handcam/frames/train/lab/3/Lhand/Image%s.png"%(num_lab3_L)
num_lab3_L+=1
elif num_lab3_R<=730:
img_path = "../../../../Disk2/cedl/handcam/frames/train/lab/3/Rhand/Image%s.png"%(num_lab3_R)
num_lab3_R+=1
elif num_lab4_L<=660:
img_path = "../../../../Disk2/cedl/handcam/frames/train/lab/4/Lhand/Image%s.png"%(num_lab4_L)
num_lab4_L+=1
elif num_lab4_R<=660:
img_path = "../../../../Disk2/cedl/handcam/frames/train/lab/4/Rhand/Image%s.png"%(num_lab4_R)
num_lab4_R+=1
elif num_off1_L<=745:
img_path = "../../../../Disk2/cedl/handcam/frames/train/office/1/Lhand/Image%s.png"%(num_off1_L)
num_off1_L+=1
elif num_off1_R<=745:
img_path = "../../../../Disk2/cedl/handcam/frames/train/office/1/Rhand/Image%s.png"%(num_off1_R)
num_off1_R+=1
elif num_off2_L<=572:
img_path = "../../../../Disk2/cedl/handcam/frames/train/office/2/Lhand/Image%s.png"%(num_off2_L)
num_off2_L+=1
elif num_off2_R<=572:
img_path = "../../../../Disk2/cedl/handcam/frames/train/office/2/Rhand/Image%s.png"%(num_off2_R)
num_off2_R+=1
elif num_off3_L<=651:
img_path = "../../../../Disk2/cedl/handcam/frames/train/office/3/Lhand/Image%s.png"%(num_off3_L)
num_off3_L+=1
elif num_off3_R<=651:
img_path = "../../../../Disk2/cedl/handcam/frames/train/office/3/Rhand/Image%s.png"%(num_off3_R)
num_off3_R+=1
img = Image.open(img_path)
img = np.array(img)
x_img = np.resize(img, [128,248,3])
x_img = x_img/255.0

scipy.misc.imsave('frames_resize/Image%s.png'%i, x_img)

def read_data_test(batch):

global num_house1_L,num_house2_L,num_house3_L,num_lab1_L,num_lab2_L,num_lab3_L,num_lab4_L
global num_house1_R,num_house2_R,num_house3_R,num_lab1_R,num_lab2_R,num_lab3_R,num_lab4_R
global num_off1_R, num_off2_R, num_off3_R, num_off1_L, num_off2_L, num_off3_L
global img_path
for i in range(batch):
if num_house1_L<=830:
img_path = "../../../../Disk2/cedl/handcam/frames/test/house/1/Lhand/Image%s.png"%(num_house1_L)
num_house1_L+=1
elif num_house1_R<=830:
img_path = "../../../../Disk2/cedl/handcam/frames/test/house/1/Rhand/Image%s.png"%(num_house1_R)
num_house1_R+=1
elif num_house2_L<=887:
img_path = "../../../../Disk2/cedl/handcam/frames/test/house/2/Lhand/Image%s.png"%(num_house2_L)
num_house2_L+=1
elif num_house2_R<=887:
img_path = "../../../../Disk2/cedl/handcam/frames/test/house/2/Rhand/Image%s.png"%(num_house2_R)
num_house2_R+=1
elif num_house3_L<=929:
img_path = "../../../../Disk2/cedl/handcam/frames/test/house/3/Lhand/Image%s.png"%(num_house3_L)
num_house3_L+=1
elif num_house3_R<=929:
img_path = "../../../../Disk2/cedl/handcam/frames/test/house/3/Rhand/Image%s.png"%(num_house3_R)
num_house3_R+=1
elif num_lab1_L<=539:
img_path = "../../../../Disk2/cedl/handcam/frames/test/lab/1/Lhand/Image%s.png"%(num_lab1_L)
num_lab1_L+=1
elif num_lab1_R<=539:
img_path = "../../../../Disk2/cedl/handcam/frames/test/lab/1/Rhand/Image%s.png"%(num_lab1_R)
num_lab1_R+=1
elif num_lab2_L<=658:
img_path = "../../../../Disk2/cedl/handcam/frames/test/lab/2/Lhand/Image%s.png"%(num_lab2_L)
num_lab2_L+=1
elif num_lab2_R<=658:
img_path = "../../../../Disk2/cedl/handcam/frames/test/lab/2/Rhand/Image%s.png"%(num_lab2_R)
num_lab2_R+=1
elif num_lab3_L<=467:
img_path = "../../../../Disk2/cedl/handcam/frames/test/lab/3/Lhand/Image%s.png"%(num_lab3_L)
num_lab3_L+=1
elif num_lab3_R<=467:
img_path = "../../../../Disk2/cedl/handcam/frames/test/lab/3/Rhand/Image%s.png"%(num_lab3_R)
num_lab3_R+=1
elif num_lab4_L<=503:
img_path = "../../../../Disk2/cedl/handcam/frames/test/lab/4/Lhand/Image%s.png"%(num_lab4_L)
num_lab4_L+=1
elif num_lab4_R<=503:
img_path = "../../../../Disk2/cedl/handcam/frames/test/lab/4/Rhand/Image%s.png"%(num_lab4_R)
num_lab4_R+=1
elif num_off1_L<=590:
img_path = "../../../../Disk2/cedl/handcam/frames/test/office/1/Lhand/Image%s.png"%(num_off1_L)
num_off1_L+=1
elif num_off1_R<=590:
img_path = "../../../../Disk2/cedl/handcam/frames/test/office/1/Rhand/Image%s.png"%(num_off1_R)
num_off1_R+=1
elif num_off2_L<=419:
img_path = "../../../../Disk2/cedl/handcam/frames/test/office/2/Lhand/Image%s.png"%(num_off2_L)
num_off2_L+=1
elif num_off2_R<=419:
img_path = "../../../../Disk2/cedl/handcam/frames/test/office/2/Rhand/Image%s.png"%(num_off2_R)
num_off2_R+=1
elif num_off3_L<=566:
img_path = "../../../../Disk2/cedl/handcam/frames/test/office/3/Lhand/Image%s.png"%(num_off3_L)
num_off3_L+=1
elif num_off3_R<=566:
img_path = "../../../../Disk2/cedl/handcam/frames/test/office/3/Rhand/Image%s.png"%(num_off3_R)
num_off3_R+=1
img = Image.open(img_path)
img = np.array(img)
x_img = np.resize(img, [128,248,3])
x_img = x_img/255.0

scipy.misc.imsave('test_resize/Image%s.png'%i, x_img)

read_data_test(12776)
read_data(14992)
Binary file added results/ges.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added results/ges_precision-recall.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
112 changes: 96 additions & 16 deletions results/index.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,124 @@
# Your Name <span style="color:red">(id)</span>
# 邱煜淵 <span style="color:red">(105061634)</span>

#Project 5: Deep Classification

## Overview
The project is related to
> quote
The project is related to object classification. There are two different case. One is every task has itself model. The other is just one model handle multiple task (Obj, Ged and FA). Some experiments photos are not already finish so I will make up its as soon.
> quote https://github.com/CEDL2017/homework1


## Implementation
1. One
* item
* item
2. Two
### Result
<p>Average FA loss : 0.743
<p>Average FA accuracy : 0.509 (use shallower network, train 50 epoch)
<p>Average Ges loss : 1.7635
<p>Average Ges accuracy : 0.9253 (use deeper network, train 60 epoch)
<p>Average Obj loss : 2.268
<p>Average Obj accuracy : 0.538

### Spotlight code

```
Code highlights
with tf.name_scope('C1_Conv'):
W1 = weight([3,3,3,36])
b1 = bias([36])
Conv1 = conv2d(x_image, W1)+b1
Conv1_BN = BN(Conv1, 36)
C1_Conv = tf.nn.relu(Conv1_BN)
with tf.name_scope('C2_Conv'):
W2 = weight([3,3,36,36])
b2 = bias([36])
Conv2 = conv2d(C1_Conv, W2)+b2
Conv2_BN = BN(Conv2, 36)
C2_Conv = tf.nn.relu(Conv2_BN)
with tf.name_scope('C1_Pool'):
C1_Pool = max_pooling(C2_Conv)

with tf.name_scope('C3_Conv'):
W3 = weight([3,3,36,64])
b3 = bias([64])
Conv3 = conv2d(C1_Pool, W3)+b3
Conv3_BN = BN(Conv3, 64)
C3_Conv = tf.nn.relu(Conv3_BN)
C3_concate = tf.concat([C1_Pool, C3_Conv],3)
with tf.name_scope('C4_Conv'):
W4 = weight([3,3,100,128])
b4 = bias([128])
Conv4 = conv2d(C3_concate, W4)+b4
Conv4_BN = BN(Conv4, 128)
C4_Conv = tf.nn.relu(Conv4_BN)
with tf.name_scope('C2_Pool'):
C2_Pool = max_pooling(C4_Conv)

with tf.name_scope('C5_Conv'):
W8 = weight([3,3,128,128])
b8 = bias([128])
Conv5 = conv2d(C2_Pool, W8)+b8
Conv5_BN = BN(Conv5, 128)
C5_Conv = tf.nn.relu(Conv5_BN)
C5_concate = tf.concat([C2_Pool, C5_Conv],3)
with tf.name_scope('C6_Conv'):
W9 = weight([3,3,256,256])
b9 = bias([256])
Conv6 = conv2d(C5_concate, W9)+b9
Conv6_BN = BN(Conv6, 256)
C6_Conv = tf.nn.relu(Conv6_BN)
with tf.name_scope('C3_Pool'):
C3_Pool = max_pooling(C6_Conv)

with tf.name_scope('C7_Conv'):
W10 = weight([3,3,256,256])
b10 = bias([256])
Conv7 = conv2d(C3_Pool, W10)+b10
Conv7_BN = BN(Conv7, 256)
C7_Conv = tf.nn.relu(Conv7_BN)
C7_concate = tf.concat([C3_Pool, C7_Conv],3)
with tf.name_scope('C8_Conv'):
W11 = weight([3,3,512,512])
b11 = bias([512])
Conv8 = conv2d(C7_concate, W11)+b11
Conv8_BN = BN(Conv8, 512)
C8_Conv = tf.nn.relu(Conv8_BN)
with tf.name_scope('C4_Pool'):
C4_Pool = max_pooling(C8_Conv)
```

## Installation
* Other required packages.
* python2.7
* tensorflow
* numpy
* PIL
* How to compile from source?

<p>First, you must resize the input image.<p>

>$ python data_resize.py

Than you can chose which task you want to train.

>$ python train.py or $ python train_obj.py

Last, you can test your model.

>$ python test.py
### Results

<table border=1>
<tr>
<td>
<img src="placeholder.jpg" width="24%"/>
<img src="placeholder.jpg" width="24%"/>
<img src="placeholder.jpg" width="24%"/>
<img src="multiple_loss.jpg" width="24%"/>
<img src="multiple_acc.jpg" width="24%"/>
<img src="obj_precision-recall.png" width="24%"/>
<img src="placeholder.jpg" width="24%"/>
</td>
</tr>

<tr>
<td>
<img src="placeholder.jpg" width="24%"/>
<img src="placeholder.jpg" width="24%"/>
<img src="placeholder.jpg" width="24%"/>
<img src="placeholder.jpg" width="24%"/>
<img src="ges_precision-recall.png" width="24%"/>
<img src="ges.jpg" width="24%"/>
<img src="FA_precision-recall.png" width="24%"/>
<img src="FA.png" width="24%"/>
</td>
</tr>

Expand Down
Binary file added results/model.ckpt.index
Binary file not shown.
Binary file added results/model.ckpt.meta
Binary file not shown.
Binary file added results/model_FA.ckpt.index
Binary file not shown.
Binary file added results/model_FA.ckpt.meta
Binary file not shown.
Binary file added results/model_ges.ckpt.index
Binary file not shown.
Binary file added results/model_ges.ckpt.meta
Binary file not shown.
Binary file added results/model_obj.ckpt.index
Binary file not shown.
Binary file added results/model_obj.ckpt.meta
Binary file not shown.
Binary file added results/multiple_acc.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added results/multiple_loss.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added results/obj_precision-recall.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading