Open luisfmnunes opened 2 years ago
@luisfmnunes, the warning issued is fixed with pr #11647 in master. You can try our 1.12 release candidate: https://test.pypi.org/project/ort-nightly/1.12.0.dev20220707003/.
For 'Graph is not a DAG' issue, could you please share the model and a sample data to repro if possible?
@luisfmnunes, the warning issued is fixed with pr #11647 in master. You can try our 1.12 release candidate: https://test.pypi.org/project/ort-nightly/1.12.0.dev20220707003/.
For 'Graph is not a DAG' issue, could you please share the model and a sample data to repro if possible?
Thank you for your response @yufenglee. The model and some sample data are available in this GoogleDrive link because it surpasses github file size. I'll also try it out with the given RC.
Forgot to provide the preprocessing functions as follows (requires numpy and opencv-python):
def preprocessing(im, height=640, width=640, reshape=False):
im = np.float32(im)
im -= (104, 117, 123)
det_scale = 1
if reshape:
im_ratio = float(im.shape[0]) / im.shape[1]
model_ratio = 1
if im_ratio>model_ratio:
new_height = height
new_width = int(new_height / im_ratio)
else:
new_width = width
new_height = int(new_width * im_ratio)
det_scale = float(new_height) / im.shape[0]
resized_img = cv2.resize(im, (new_width, new_height))
det_im = np.zeros((height,width,3),dtype=np.float32)
det_im [:new_height,:new_width,:] = resized_img
im = det_im
im = im.transpose(2,0,1)
im = im[np.newaxis, ...]
return im, det_scale
def preprocessing_folder(images_folder, height, width, size_limit=0):
image_names = [im for im in os.listdir(images_folder) if os.path.isfile(os.path.join(images_folder,im))]
if size_limit > 0 and len(image_names) >= size_limit:
batch_filenames = image_names[:size_limit]
else:
batch_filenames = image_names
unconcatenated_batch_data = []
for image_name in batch_filenames:
im = cv2.imread(os.path.join(images_folder,image_name))
im, _ = preprocessing(im)
# print(im.shape)
unconcatenated_batch_data.append(im)
return unconcatenated_batch_data
System information
Is it possible to quantize a model with dynamic shaped inputs statically? I'm trying to quantize a ResNet50 Model statically, but since the input is dynamic ('batch', 3, 'height', 'width') the quantization method is raising numeroues "Expected Shape" warning, failing to quantize the model in the end. There is a sample from the output and the quantize_static call below.