PyTorchClassification/onnx_test_driver.py [87:105]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    M = max(w,h) * MODEL_RESIZE_SIZE
    targetW = round(M * 1.0 / h)
    targetH = round(M * 1.0 / w)

    # Resize short side to RESIZE_SCALE_FACTOR * TARGET_SIZE
    imgResized = cv2.resize(imgRgb, (targetW, targetH))

    # Center crop at TARGET_SIZE * TARGET_SIZE
    startCol = (targetW//2)-(MODEL_IMAGE_SIZE//2)
    endCol = (targetW//2)+(MODEL_IMAGE_SIZE//2)
    startRow = (targetH//2)-(MODEL_IMAGE_SIZE//2)
    endRow = (targetH//2)+(MODEL_IMAGE_SIZE//2)

    imgCropped = imgResized[startRow:endRow,startCol:endCol,:]
    s = imgCropped.shape; assert(s[0] == MODEL_IMAGE_SIZE and s[1] == MODEL_IMAGE_SIZE)

    # Convert to NCHW
    imgFinal = np.transpose(imgCropped, (2,0,1))
    imgExpanded = np.expand_dims(imgFinal,0).astype('float32')
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



PyTorchClassification/onnx_validate.py [101:121]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    M = max(w,h) * MODEL_RESIZE_SIZE
    targetW = round(M * 1.0 / h)
    targetH = round(M * 1.0 / w)
    ############################################
    ## END CHANGE
    ############################################
    # Resize short side to RESIZE_SCALE_FACTOR * TARGET_SIZE
    imgResized = cv2.resize(imgRgb, (targetW, targetH))

    # Center crop at TARGET_SIZE * TARGET_SIZE
    startCol = (targetW//2)-(MODEL_IMAGE_SIZE//2)
    endCol = (targetW//2)+(MODEL_IMAGE_SIZE//2)
    startRow = (targetH//2)-(MODEL_IMAGE_SIZE//2)
    endRow = (targetH//2)+(MODEL_IMAGE_SIZE//2)

    imgCropped = imgResized[startRow:endRow,startCol:endCol,:]
    s = imgCropped.shape; assert(s[0] == MODEL_IMAGE_SIZE and s[1] == MODEL_IMAGE_SIZE)

    # Convert to NCHW
    imgFinal = np.transpose(imgCropped, (2,0,1))
    imgExpanded = np.expand_dims(imgFinal,0).astype('float32')
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



