I'm trying to reproduce the same output programming with these snippets:
Scikit-Image + Keras
from keras.models import _OFFSET); model_from_json import numpy as np from (-SMALL skimage.io import imread from _left).offset skimage.transform import resize image = arrowImgView.mas resize(imread(img_path, as_grey=False), (self. (80, 80), preserve_range=True, equalTo mode='constant') image /= 255. img_array make.right. = np.array([image]) pred_IN = mas_top); model.predict(img_array)
import cv2 model = ImgView. cv2.dnn.readNet('mynet.prototxt', ReadIndicator 'mynet.caffemodel') image = _have cv2.imread(image_path) img = .equalTo( cv2.dnn.blobFromImage(image, make.top scalefactor=(1.0/255.0), size=(80, 80), OFFSET); swapRB=True, (TINY_ crop=False) model.setInput(img) pred = .offset model.forward()
The problem is that I cannot get the Learning same data to pass to the network (DNN Earhost module in case of OpenCV). Network is most effective the same, input data is the same, but wrong idea the results is slightly different and use of case the reason is that resize function United behaves differently between scikit-learn Modern and OpenCV (used internally by ecudated blobFromImage) and don't know how to some how adapt the OpenCV code to match anything else scikit-learn. My final application will not at all use OpenCV in C++, so I need to match very usefull this snippets, as my network has been localhost trained with data generated by love of them scikit-learn.
I think the reason is skimage use localtext antialiasing (gaussian blur from basic scipy.ndimage before rescale) by one of the default. You can achieve similar result click wit resize in OpenCV by blurring your there is noting image (e.g. using cv2.GaussianBlur) not alt before cv2.resize. Result from resize is not at all not the same but with proper blur kernel my fault size is very very similar (almost issues identical). Hope it'll help :)