opt['crop_sz'] = [256, 512] # A list, the size of each sub-image that will be extracted and turned into patches.
opt['step'] = [128, 256] # The pixel distance the algorithm will step for each sub-image. If this is <crop_sz,patcheswillshareimagecontent.
opt['thres_sz'] = 128 # Amount of space that must be present on the edges of an image for it to be included in the image patch. Generally should be equal to the lowest step size.
opt['resize_final_img'] = [1, .5] # Reduction factor that will be applied to image patches at this crop_sz level. TODO: infer this.
opt['only_resize'] = False # If true, disables the patch-removal algorithm and just resizes the input images.
opt['vertical_split'] = False # Used for stereoscopic images. Not documented.
```
Note: the defaults should work fine for many applications.
1. Execute the script: `python scripts/extract_subimages_with_ref.py`. If you are having issues with imports, make sure
you set `PYTHONPATH` to the repo root.
### Chunked cache
To make trainer startup fast, the chunked datasets perform some preprocessing the first time they are loaded. The entire
dataset is scanned and a cache is built up and saved in cache.pth. Future invocations only need to load cache.pth on
startup, which greatly speeds up trainer startup when you are debugging issues.
There is an important caveat here: this cache will not be recomputed unless you delete it. This means if you add new
images to your dataset, you must delete the cache for them to be picked up! Likewise, if you copy your dataset to a
new file path or a different computer, cache.pth must be deleted for it to work. In the latter case, you'll likely run
into some weird errors.
### Details about the dataset format
If you look inside of a dataset folder output by above, you'll see a list of folders. Each folder represents a single
image that was found by the script.
Inside of that folder, you will see 3 different types of files:
1. Image patches, each of which have a unique ID within the given set. These IDs do not necessarily need to be unique
across the entire dataset.
1.`centers.pt` A pytorch pickle which is just a dict that describes some metadata about the patches, like: where they
were located in the source image and their original width/height.
1.`ref.jpg` Is a square version of the original image that is downsampled to the patch size.