-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Angelica] Extract feature and data modules/methods into separate dir…
…ectories
- Loading branch information
1 parent
e2403d0
commit 197bba9
Showing
211 changed files
with
135 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,5 @@ pip-selfcheck.json | |
share/ | ||
dist/ | ||
Riot_python.egg-info | ||
*.pyc | ||
*.pyc | ||
build/ |
Empty file.
Empty file.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import os | ||
from feature import Feature | ||
import numpy as np | ||
|
||
|
||
class DataProcessor: | ||
""" | ||
Class containing all necessary data preprocessing methods. | ||
""" | ||
|
||
def get_image_feature_array(self, root_directory, vector=True): | ||
""" | ||
Extracts features vectors of all images found in root_directory. | ||
:param root_directory: location of image data | ||
:param vector: if true returns features as vectors, otherwise as 2D arrays | ||
:return: numpy array of extracted feature vectors | ||
""" | ||
feature_index = 0 if vector else 1 | ||
feature = Feature() | ||
features = list() | ||
for sub_directory in os.listdir(root_directory): | ||
if not sub_directory.startswith('.'): | ||
sub_directory_path = root_directory + '/' + sub_directory | ||
for image_file in os.listdir(sub_directory_path): | ||
if not image_file.startswith('.'): | ||
image_file_path = sub_directory_path + '/' + image_file | ||
features.append([[feature.extract_hog_feature_vector(image_file_path)[feature_index]]]) | ||
|
||
return np.array(features) | ||
|
||
def get_time_series_image_feature_array(self, root_directory, vector=True): | ||
""" | ||
Extracts features vectors of images found in root_directory and groups them | ||
by time_series batch. Subdirectories of root_directory must contain a single | ||
time series batch. | ||
:param root_directory: location of image data | ||
:param vector: if true returns features as vectors, otherwise as 2D arrays | ||
:return: numpy array of arrays which contain time series batch features | ||
""" | ||
feature_index = 0 if vector else 1 | ||
feature = Feature() | ||
features = list() | ||
for sub_directory in os.listdir(root_directory): | ||
if not sub_directory.startswith('.'): | ||
sub_directory_path = root_directory + '/' + sub_directory | ||
for image_file in os.listdir(sub_directory_path): | ||
feature_batch = list() | ||
if not image_file.startswith('.'): | ||
image_file_path = sub_directory_path + '/' + image_file | ||
feature_batch.append(feature.extract_hog_feature_vector(image_file_path)[feature_index]) | ||
features.append(feature_batch) | ||
|
||
return np.array(features) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
If you use this dataset in your research work, please cite | ||
|
||
"Challenges in Representation Learning: A report on three machine learning | ||
contests." I Goodfellow, D Erhan, PL Carrier, A Courville, M Mirza, B | ||
Hamner, W Cukierski, Y Tang, DH Lee, Y Zhou, C Ramaiah, F Feng, R Li, | ||
X Wang, D Athanasakis, J Shawe-Taylor, M Milakov, J Park, R Ionescu, | ||
M Popescu, C Grozea, J Bergstra, J Xie, L Romaszko, B Xu, Z Chuang, and | ||
Y. Bengio. arXiv 2013. | ||
|
||
See fer2013.bib for a bibtex entry. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
@MISC{Goodfeli-et-al-2013, | ||
author = {Goodfellow, Ian and Erhan, Dumitru and Carrier, Pierre-Luc and Courville, Aaron and Mirza, Mehdi and Hamner, Ben and Cukierski, Will and Tang, Yichuan and Thaler, David and Lee, Dong-Hyun and Zhou, Yingbo and Ramaiah, Chetan and Feng, Fangxiang and Li, Ruifan and Wang, Xiaojie and Athanasakis, Dimitris and Shawe-Taylor, John and Milakov, Maxim and Park, John and Ionescu, Radu and Popescu, Marius and Grozea, Cristian and Bergstra, James and Xie, Jingjing and Romaszko, Lukasz and Xu, Bing and Chuang, Zhang and Bengio, Yoshua}, | ||
keywords = {competition, dataset, representation learning}, | ||
title = {Challenges in Representation Learning: A report on three machine learning contests}, | ||
year = {2013}, | ||
institution = {Unicer}, | ||
url = {http://arxiv.org/abs/1307.0414}, | ||
abstract = {The ICML 2013 Workshop on Challenges in Representation | ||
Learning focused on three challenges: the black box learning challenge, | ||
the facial expression recognition challenge, and the multimodal learn- | ||
ing challenge. We describe the datasets created for these challenges and | ||
summarize the results of the competitions. We provide suggestions for or- | ||
ganizers of future challenges and some comments on what kind of knowl- | ||
edge can be gained from machine learning competitions. | ||
http://deeplearning.net/icml2013-workshop-competition} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import sys | ||
sys.path.append('../feature') | ||
from dataProcessor import DataProcessor | ||
|
||
|
||
d = DataProcessor() | ||
root_directory = "../data/cohn_kanade_images" | ||
feature_images = d.get_time_series_image_feature_array(root_directory) | ||
|
||
print(feature_images.shape) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.