Skip to content

2_Folder organization

Sharon Fitzpatrick edited this page Dec 7, 2022 · 1 revision

📙 Folder organization

For each model, there are 3 files:

  1. config file: this is the file that was used by Segmentation Gym to create the weights file. It contains instructions for how to make the model and the data it used, as well as instructions for how to use the model for prediction. It is a handy wee thing and mastering it means mastering the entire Doodleverse. It is needed by the Segmentation Gym function seg_images_in_folder.py to segment a folder of images, along with the weights file described below. If you want to learn more about how the config file is designed go check out segmentation gym's wiki.

  2. weights file: this is the file that was created by the Segmentation Gym function train_model.py. It contains the trained model's parameter weights. It can called by the Segmentation Gym function seg_images_in_folder.py or the Segmentation Zoo function select_model_and_batch_process_folder.py to segment a folder of images

  3. model card file: this is a json file containing the following fields that collectively describe the model origins, training choices, and dataset that the model is based upon. There is some redundancy between this file and the config file (described above) that contains the instructions for the model training and implementation. The model card file is not used by the program but is important metadata

{
	"DETAILS": {
	"NAME": "name of model set",
    "DATE": "YYYY-MM-DD",
    "URL":"string",
    "CITATION":"Bloggs, J. (2022) Name. Zenodo data release XXXXXXX",
    "QUERIES": "email or website",
    "CREDIT":"Name",
    "INTENDED_PURPOSE":"Description",
    "KEYWORDS": {
      "1": "keyword 1",
      "2": "keyword 2"
    }
	},  
	"DATASET": {
	"NAME": "Dataset name", 
    "SOURCE": "dataset url or description of how to obtain data",
    "CITATION": "Bloggs et al 2022, Name of dataset: Publisher, URL",
    "NUMBER_LABELED_IMAGES": 999999,
		"CLASSES": {
			"0": "class 1",
			"1": "class 2",
			"2": "class 3"
		},
		"ORIG_CLASSES": {
			"0": "orig class 1",
			"1": "orig class 2",
			"2": "orig class 3",
			"3": "orig class 4"
		},
		"REMAP_CLASSES": {
			"0": 0,
			"1": 2,
			"2": 4,
			"3": 6
		},
		"N_DATA_BANDS": 3,
    "BAND_NAMES": {
      "0": "red",
      "1": "green",
      "2": "blue"
    }
	},
	"MODEL": {
	"NAME": "resunet",
    "KERNEL":7,
    "STRIDE":2,
    "FILTERS":6    
	},
	"TRAINING": {
    "BATCH_SIZE": 8,
    "DROPOUT":0.1,
    "DROPOUT_CHANGE_PER_LAYER":0.0,
    "DROPOUT_TYPE":"standard",
    "USE_DROPOUT_ON_UPSAMPLING":false,
    "LOSS":"cat",
    "PATIENCE": 10,
    "MAX_EPOCHS": 100,
    "VALIDATION_SPLIT": 0.6,
    "RAMPUP_EPOCHS": 20,
    "SUSTAIN_EPOCHS": 0.0,
    "EXP_DECAY": 0.9,
    "START_LR":  1e-7,
    "MIN_LR": 1e-7,
    "MAX_LR": 1e-4   
	},
	"AUGMENTATION": {
    "AUGMENTATION_USED": true,
    "FILTER_VALUE": 0,
    "AUG_ROT": 0.05,
    "AUG_ZOOM": 0.05,
    "AUG_WIDTHSHIFT": 0.05,
    "AUG_HEIGHTSHIFT": 0.05,
    "AUG_HFLIP": true,
    "AUG_VFLIP": false,
    "AUG_LOOPS": 10,
    "AUG_COPIES": 5  
	}     
}