Skip to content

Commit

Permalink
Updated code for sinusoidal, multivariate, UCI and human pose experim…
Browse files Browse the repository at this point in the history
…ents
  • Loading branch information
meghshukla committed Jan 8, 2024
1 parent 355c496 commit cc67ee9
Show file tree
Hide file tree
Showing 61 changed files with 241,905 additions and 2 deletions.
2,958 changes: 2,958 additions & 0 deletions HumanPose/cached/Stacked_HG_ValidationImageNames.txt

Large diffs are not rendered by default.

62 changes: 62 additions & 0 deletions HumanPose/code/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import os
import yaml
import shutil
import logging
from pathlib import Path


class ParseConfig(object):
"""
Loads and returns the configuration specified in configuration.yml
"""
def __init__(self) -> None:

# 1. Load the configuration file ------------------------------------------------------------------------------
try:
f = open('configuration.yml', 'r')
conf_yml = yaml.load(f, Loader=yaml.FullLoader)
f.close()
except FileNotFoundError:
logging.warning('Could not find configuration.yml')
exit()


# 2. Initializing ParseConfig object --------------------------------------------------------------------------
self.trials = conf_yml['trials']
self.dataset = conf_yml['dataset']
self.experiment_settings = conf_yml['experiment_settings']
self.architecture = conf_yml['architecture']
self.use_hessian = conf_yml['use_hessian']
self.load_images = conf_yml['load_images']


# 3. Extra initializations based on configuration chosen ------------------------------------------------------
# Number of convolutional channels for AuxNet
self.architecture['aux_net']['channels'] = [self.architecture['hourglass']['channels']] * 7
self.architecture['aux_net']['spatial_dim'] = [64, 32, 16, 8, 4, 2, 1]

# Number of heatmaps (or joints)
self.experiment_settings['num_hm'] = 14
self.architecture['hourglass']['num_hm'] = 14
self.architecture['aux_net']['num_hm'] = 14

# Number of output nodes for the aux_network
self.architecture['aux_net']['fc'].append(((2 * self.architecture['aux_net']['num_hm']) ** 2) + 2)


# 4. Create directory for model save path ----------------------------------------------------------------------
self.experiment_name = conf_yml['experiment_name']
i = 1
model_save_path = os.path.join(conf_yml['save_path'], self.experiment_name + '_' + str(i))
while os.path.exists(model_save_path):
i += 1
model_save_path = os.path.join(conf_yml['save_path'], self.experiment_name + '_' + str(i))

logging.info('Saving the model at: ' + model_save_path)

# Copy the configuration file into the model dump path
code_directory = Path(os.path.abspath(__file__)).parent
shutil.copytree(src=str(code_directory),
dst=os.path.join(model_save_path, code_directory.parts[-1]))

self.save_path = model_save_path
25 changes: 25 additions & 0 deletions HumanPose/code/configuration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
experiment_name: "TIC-TAC"

trials: 1
use_hessian: False

save_path: "/absolute/path/to/directory/"

dataset: {
mpii_params: {precached: False}
# precached: True implies this exists, False does the post-process and also saves a copy
}

experiment_settings: {
epochs: 100, # Default: 100
lr: 0.01, # Default: 1e-2
batch_size: 32, # Default: 32
}

architecture: {
hourglass: {nstack: 2, channels: 64},
aux_net: {fc: [64, 64, 64]}
}

# If RAM permits, load all images into memory
load_images: True
Loading

0 comments on commit cc67ee9

Please sign in to comment.