Skip to content

Commit

Permalink
Remove bogus functions
Browse files Browse the repository at this point in the history
These are implemented in the view
  • Loading branch information
lukeyeager committed Jul 10, 2015
1 parent 9e3f4da commit c857340
Showing 1 changed file with 0 additions and 118 deletions.
118 changes: 0 additions & 118 deletions digits/dataset/images/classification/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,121 +67,3 @@ def __setstate__(self, state):
def job_type(self):
return 'Image Classification Dataset'

def from_folder(self, folder,
percent_val=None, percent_test=None,
min_per_category=None,
max_per_category=None,
):
"""
Add tasks for creating a dataset by parsing a folder of images
Arguments:
folder -- the folder to parse
Keyword arguments:
percent_val -- percent of images to use for validation
percent_test -- percent of images to use for testing
min_per_category -- minimum images per category
max_per_category -- maximum images per category
"""
assert len(self.tasks) == 0

self.labels_file = utils.constants.LABELS_FILE

### Add ParseFolderTask

task = tasks.ParseFolderTask(
job_dir = self.dir(),
folder = folder,
percent_val = percent_val,
percent_test= percent_test
)
self.tasks.append(task)

### Add CreateDbTasks

self.tasks.append(
tasks.CreateDbTask(
job_dir = self.dir(),
parents = task,
input_file = utils.constants.TRAIN_FILE,
db_name = utils.constants.TRAIN_DB,
image_dims = self.image_dims,
resize_mode = self.resize_mode,
mean_file = utils.constants.MEAN_FILE_CAFFE,
labels_file = self.labels_file,
)
)

if task.percent_val > 0:
self.tasks.append(
tasks.CreateDbTask(
job_dir = self.dir(),
parents = task,
input_file = utils.constants.VAL_FILE,
db_name = utils.constants.VAL_DB,
image_dims = self.image_dims,
resize_mode = self.resize_mode,
labels_file = self.labels_file,
)
)

if task.percent_test > 0:
self.tasks.append(
tasks.CreateDbTask(
job_dir = self.dir(),
parents = task,
input_file = utils.constants.TEST_FILE,
db_name = utils.constants.TEST_DB,
image_dims = self.image_dims,
resize_mode = self.resize_mode,
labels_file = self.labels_file,
)
)

def from_files(self):
"""
Checks for files already in the directory
"""
assert len(self.tasks) == 0

assert os.path.exists(self.path(utils.constants.TRAIN_FILE))
assert os.path.exists(self.path(utils.constants.LABELS_FILE))
self.labels_file = utils.constants.LABELS_FILE

self.tasks.append(
tasks.CreateDbTask(
job_dir = self.dir(),
input_file = utils.constants.TRAIN_FILE,
db_name = utils.constants.TRAIN_DB,
image_dims = self.image_dims,
resize_mode = self.resize_mode,
mean_file = utils.constants.MEAN_FILE_CAFFE,
labels_file = self.labels_file,
)
)

if os.path.exists(self.path(utils.constants.VAL_FILE)):
self.tasks.append(
tasks.CreateDbTask(
job_dir = self.dir(),
input_file = utils.constants.VAL_FILE,
db_name = utils.constants.VAL_DB,
image_dims = self.image_dims,
resize_mode = self.resize_mode,
labels_file = self.labels_file,
)
)

if os.path.exists(self.path(utils.constants.TEST_FILE)):
self.tasks.append(
tasks.CreateDbTask(
job_dir = self.dir(),
input_file = utils.constants.TEST_FILE,
db_name = utils.constants.TEST_DB,
image_dims = self.image_dims,
resize_mode = self.resize_mode,
labels_file = self.labels_file,
)
)

0 comments on commit c857340

Please sign in to comment.