def train2rect(ratios, imagew, imageh):
    """
    Takes in data used during training and transforms it into format matching
    the format outputted by darknet's valid function.
    """
    xratio, yratio, wratio, hratio = ratios
    xmin = xratio*imagew - wratio*imagew/2
    ymin = yratio*imageh - hratio*imageh/2
    xmax = xratio*imagew + wratio*imagew/2
    ymax = yratio*imageh + hratio*imageh/2
    
    return (xmin, ymin, xmax, ymax)