Downsample YOLO Outputs:¶
- ds_yolo_output.downsample_yolo_output(fpath, n, ds_factor=2, outdir=None)¶
Downsample the output from our custom YOLO pipeline. The tensor stored in the input file (.npy) will be downsampled ‘n’ times by a factor of ds_factor
- Parameters:
fpath (str) – The location of the file to be downsampled; Must be one of the .npy files output from the YOLO pipeline
n (int) – The number of times to downsample the image by ‘ds_factor’; For n=0, the bbox coordinate values will be replaced by their area.
ds_factor (int) – Default - 2; The downsampling factor for 1 iteration of downsampling
outdir (str) – Default - None; If None, don’t save the output. Else, the directory where the output will be saved
- Returns:
out – The downsampled version of the original input file
- Return type:
ndarray of float32
- ds_yolo_output.ds_outputs_to_orig_format(Ad, Pd, Fd)¶
A helper function for stacking the downsampled arrays back into the format to be saved as an .npy file
- ds_yolo_output.orig_format_to_ds_outputs(out)¶
A helper function for breaking down the stacked arrays back into the intermediate outputs from downsampling - Ad, Pd, and Fd
- ds_yolo_output.plot_yolo_outputs(out, n)¶
Generate a set of 4 plots visualizing the downsampled output.
- Parameters:
out (ndarray of shape (R, C, 5)) – The downsampled YOLO output
n (int) – The number of times ‘out’ was downsampled from the original
- Returns:
fig (matplotlib.pyplot.figure) – The figure obhect visualizing the 4 subplots
ax (matplotlib.pyplot.axes) – The axes object containing the 4 subplots