def bgra2rgb(img):
    '\n        cv2.cvtColor(img, cv2.COLOR_BGRA2BGR) has an issue removing the alpha channel,\n        this gets rid of wrong transparent colors that can harm training\n    '
    if (img.shape[2] == 4):
        (b, g, r, a) = cv2.split(img.astype(np.uint8))
        b = cv2.bitwise_and(b, b, mask=a)
        g = cv2.bitwise_and(g, g, mask=a)
        r = cv2.bitwise_and(r, r, mask=a)
        return cv2.merge([b, g, r])
    return img
cv2.cvtColor(img, cv2.COLOR_BGRA2BGR) has an issue removing the alpha channel,
this gets rid of wrong transparent colors that can harm training
def bgra2rgb(img):
    '\n        cv2.cvtColor(img, cv2.COLOR_BGRA2BGR) has an issue removing the alpha channel,\n        this gets rid of wrong transparent colors that can harm training\n    '
    if (img.shape[2] == 4):
        (b, g, r, a) = cv2.split(img.astype(np.uint8))
        b = cv2.bitwise_and(b, b, mask=a)
        g = cv2.bitwise_and(g, g, mask=a)
        r = cv2.bitwise_and(r, r, mask=a)
        return cv2.merge([b, g, r])
    return img