Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change aspect ration #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
157 changes: 157 additions & 0 deletions pytorch_networks/surface_normals/config/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
# train.py Config - Training
train:
# For datasets, please pass atleast 1 value. If no datasets exist, pass "" as path for images.
# Synthetic datasets with ground truth labels
datasetsTrain:
- images: '/cleargrasp_hdd/datasets/cleargrasp1/cleargrasp-dataset-train/stemless-plastic-champagne-glass-train/rgb-imgs'
labels: '/cleargrasp_hdd/datasets/cleargrasp1/cleargrasp-dataset-train/stemless-plastic-champagne-glass-train/camera-normals'
- images: '/cleargrasp_hdd/datasets/cleargrasp1/cleargrasp-dataset-train/square-plastic-bottle-train/rgb-imgs'
labels: '/cleargrasp_hdd/datasets/cleargrasp1/cleargrasp-dataset-train/square-plastic-bottle-train/camera-normals'
- images: '/cleargrasp_hdd/datasets/cleargrasp1/cleargrasp-dataset-train/heart-bath-bomb-train/rgb-imgs'
labels: '/cleargrasp_hdd/datasets/cleargrasp1/cleargrasp-dataset-train/heart-bath-bomb-train/camera-normals'
- images: '/cleargrasp_hdd/datasets/cleargrasp1/cleargrasp-dataset-train/flower-bath-bomb-train/rgb-imgs'
labels: '/cleargrasp_hdd/datasets/cleargrasp1/cleargrasp-dataset-train/flower-bath-bomb-train/camera-normals'
- images: '/cleargrasp_hdd/datasets/cleargrasp1/cleargrasp-dataset-train/cup-with-waves-train/rgb-imgs'
labels: '/cleargrasp_hdd/datasets/cleargrasp1/cleargrasp-dataset-train/cup-with-waves-train/camera-normals'


# Synthetic datasets with ground truth labels - 10% split of train
datasetsVal:
- images: '/cleargrasp_hdd/datasets/cleargrasp1/cleargrasp-dataset-test-val/synthetic-val/stemless-plastic-champagne-glass-val/rgb-imgs'
labels: '/cleargrasp_hdd/datasets/cleargrasp1/cleargrasp-dataset-test-val/synthetic-val/stemless-plastic-champagne-glass-val/camera-normals'
- images: '/cleargrasp_hdd/datasets/cleargrasp1/cleargrasp-dataset-test-val/synthetic-val/square-plastic-bottle-val/rgb-imgs'
labels: '/cleargrasp_hdd/datasets/cleargrasp1/cleargrasp-dataset-test-val/synthetic-val/square-plastic-bottle-val/camera-normals'
- images: '/cleargrasp_hdd/datasets/cleargrasp1/cleargrasp-dataset-test-val/synthetic-val/heart-bath-bomb-val/rgb-imgs'
labels: '/cleargrasp_hdd/datasets/cleargrasp1/cleargrasp-dataset-test-val/synthetic-val/heart-bath-bomb-val/camera-normals'
- images: '/cleargrasp_hdd/datasets/cleargrasp1/cleargrasp-dataset-test-val/synthetic-val/flower-bath-bomb-val/rgb-imgs'
labels: '/cleargrasp_hdd/datasets/cleargrasp1/cleargrasp-dataset-test-val/synthetic-val/flower-bath-bomb-val/camera-normals'
- images: '/cleargrasp_hdd/datasets/cleargrasp1/cleargrasp-dataset-test-val/synthetic-val/cup-with-waves-val/rgb-imgs'
labels: '/cleargrasp_hdd/datasets/cleargrasp1/cleargrasp-dataset-test-val/synthetic-val/cup-with-waves-val/camera-normals'

# Real Images (no ground truth labels)
datasetsTestReal:
- images: '/cleargrasp_hdd/datasets/cleargrasp1/cleargrasp-dataset-test-val/real-test/d415/'
labels: ''
- images: '/cleargrasp_hdd/datasets/cleargrasp1/cleargrasp-dataset-test-val/real-test/d435/'
labels: ''
- images: '/cleargrasp_hdd/datasets/cleargrasp1/cleargrasp-dataset-test-val/real-val/d435/'
labels: ''

# Synthetic datasets with ground truth labels - Used as test set
datasetsTestSynthetic:
- images: '/cleargrasp_hdd/datasets/cleargrasp1/cleargrasp-dataset-test-val/synthetic-test/glass-round-potion-test/rgb-imgs'
labels: '/cleargrasp_hdd/datasets/cleargrasp1/cleargrasp-dataset-test-val/synthetic-test/glass-round-potion-test/camera-normals'
- images: '/cleargrasp_hdd/datasets/cleargrasp1/cleargrasp-dataset-test-val/synthetic-test/glass-square-potion-test/rgb-imgs'
labels: '/cleargrasp_hdd/datasets/cleargrasp1/cleargrasp-dataset-test-val/synthetic-test/glass-square-potion-test/camera-normals'
- images: '/cleargrasp_hdd/datasets/cleargrasp1/cleargrasp-dataset-test-val/synthetic-test/star-bath-bomb-test/rgb-imgs'
labels: '/cleargrasp_hdd/datasets/cleargrasp1/cleargrasp-dataset-test-val/synthetic-test/star-bath-bomb-test/camera-normals'
- images: '/cleargrasp_hdd/datasets/cleargrasp1/cleargrasp-dataset-test-val/synthetic-test/tree-bath-bomb-test/rgb-imgs'
labels: '/cleargrasp_hdd/datasets/cleargrasp1/cleargrasp-dataset-test-val/synthetic-test/tree-bath-bomb-test/camera-normals'

# For pretraining surface normals on Matterport3D and Scannet Datasets
datasetsMatterportTrain:
# - images: 'data/datasets/matterport3d/train/matterport_rgb/v1/scans'
# labels: 'data/datasets/matterport3d/train/matterport_render_normal'
datasetsMatterportVal:
# - images: 'data/datasets/matterport3d/val/matterport_rgb/v1/scans'
# labels: 'data/datasets/matterport3d/val/matterport_render_normal'
datasetsScannetTrain:
# - images: 'data/datasets/scannet/scannet-rgb/scans/train'
# labels: 'data/datasets/scannet/scannet_render_normal/train'
datasetsScannetVal:
# - images: 'data/datasets/scannet/scannet-rgb/scans/val'
# labels: 'data/datasets/scannet/scannet_render_normal/val'


# Training/Validation Params
model: "drn" # Possible values: ['deeplab_xception', 'deeplab_resnet', 'drn']
batchSize: 8
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do remember to increase the batch size to whatever fills the GPU mem on the cloud (ideally some factor of 32)

batchSizeMatterport: 0
batchSizeScannet: 0
validationBatchSize: 8
testBatchSize: 8
numEpochs: 500
imgHeight: 192
imgWidth: 256
numClasses: 3
numInputChannels: 3 # Num of channels in input image. RGB = 3 channels, Grayscale = 1 channel.
numWorkers: 8 # Num of workers used in the dataloader
logsDir: "logs-deeplab" # Directory where logs of each exp will be saved.
lossFunc: "cosine" # Possible values: ['cosine', 'radians']
percentageDataForTraining: 1.0 # The percentage of images in dataset to be used for training.
percentageDataForMatterportTraining: 0.5 # The percentage of images in dataset to be used for training.
percentageDataForScannetTraining: 0.35
percentageDataForValidation: 1.0
percentageDataForMatterportVal: 0.5
percentageDataForScannettVal: 0.5

# Deeplab specific
outputStride: 8 # Possible values: [8, 16]. Output stride for deeplabv3 model. Smaller values give finer details in output mask.
epochSize: 1 # After these many epochs, change learning rate

continueTraining: False # If true, continue training from a checkpoint
pathPrevCheckpoint: "checkpoints/outlines/drn-256p-contact-edges/checkpoints/checkpoint-epoch-0051.pth" # Path to .pth checkpoint file to load to continue training from
initOptimizerFromCheckpoint: False # Re-Initialize optimizer's state from checkpoint. NOTE: when this is enabled, value of learningRate will be overridden with value from checkpoint.
loadEpochNumberFromCheckpoint: False # If true, the epoch/iter numbering will start from the checkpoint's last epoch num.

saveImageInterval: 1 # Log output images to tensorboard every saveImageInterval epochs
saveImageIntervalIter: 100 # Every N iterations, log output images to tensorboard
testInterval: 1 # Run on test set every nTestInterval epochs. Keep at 0 to skip tests.
saveModelInterval: 5 # Save the model checkpoints every N epochs

# Optimizer Params
optimAdam:
learningRate: 0.0001
weightDecay: 0 # Other values: 0.0001
optimSgd:
learningRate: 1e-6
momentum: 0.9
weight_decay: 5e-4
lrScheduler: "StepLR" # Possible Values: ['', 'StepLR', 'ReduceLROnPlateau']
lrSchedulerStep:
step_size: 7
gamma: 0.1
lrSchedulerPlateau:
factor: 0.8
patience: 25
verbose: True

# eval.py Config - Validation/Testing Inference
eval:
# Synthetic datasets with ground truth labels
# Used as validation set
datasetsSynthetic:
# - images: 'data/data/datasets/val/cup-with-waves-val/source-files/rgb-imgs'
# labels: 'data/data/datasets/val/cup-with-waves-val/source-files/outlines'

# Datasets of real images, no labels available
# Used as Test set
datasetsReal:
# - images: "datasets-transparent/studio_pics_sorted/selected_test/d415"
# labels: "datasets-transparent/studio_pics_sorted/selected_test/d415"
# - images: "datasets-transparent/studio_pics_sorted/selected_test/d435"
# labels: "datasets-transparent/studio_pics_sorted/selected_test/d435"
# - images: "datasets-transparent/studio_pics_sorted/selected_val/d435"
# labels: "datasets-transparent/studio_pics_sorted/selected_val/d435"

datasetsMatterport:
# - images: 'data/datasets/matterport3d/train/matterport_rgb/v1/scans'
# labels: 'data/datasets/matterport3d/train/matterport_render_normal'

# Params
model: "drn" # Possible values: ['deeplab_xception', 'deeplab_resnet', 'drn']
numClasses: 3
batchSize: 32
imgHeight: 192
imgWidth: 256
os: 8
numWorkers: 4 # Num of workers used in the dataloader
pathWeightsFile: "checkpoints/outlines/drn-256p-contact-edges/checkpoints/checkpoint-epoch-0051.pth" # Path to the checkpoint to be loaded
resultsDir: "data/results"




#add img resizing
#chnange imgHeight in config train and eval
# chnage paths to folders
2 changes: 2 additions & 0 deletions pytorch_networks/surface_normals/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
# Train Dataset - Create a dataset object for each dataset in our list, Concatenate datasets, select subset for training
augs_train = iaa.Sequential([
# Geometric Augs
iaa.CenterCropToAspectRatio(1.33),
iaa.Resize({
"height": config.train.imgHeight,
"width": config.train.imgWidth
Expand Down Expand Up @@ -177,6 +178,7 @@

# Validation Dataset
augs_test = iaa.Sequential([
iaa.CenterCropToAspectRatio(1.33),
iaa.Resize({
"height": config.train.imgHeight,
"width": config.train.imgWidth
Expand Down