These are chat archives for beniz/deepdetect

24th
Oct 2017
Emmanuel Benazera
@beniz
Oct 24 2017 10:16
you guys may want to look at the difference in values between an image as loaded by PIL and OpenCV. Thanks.
rperdon
@rperdon
Oct 24 2017 12:05
I am rewriting the loader to use opencv to examine the differences
I've been reading how to do conversions of pil to opencv for image formats to determine differences in the loads
Emmanuel Benazera
@beniz
Oct 24 2017 13:05
So OpenCV is notoriously using BGR as default encoding (as opposed to RGB). That's the first difference you might want to look at when comparing the numpy arrays from PIL and OpenCV.
rperdon
@rperdon
Oct 24 2017 13:53
I took an approach to flipping the PIL load image to BGR and produced a binary flip of the results for some test images.
opencvImage = cv2.cvtColor(numpy.array(pil_image), cv2.COLOR_RGB2BGR)
I wonder if it would be so simple to add this into a flag option of deep detect to just transpose the numpy array
rperdon
@rperdon
Oct 24 2017 14:07
I'm working to get the output of the opencv image load matrix in order to compare
rperdon
@rperdon
Oct 24 2017 15:13
I got the extract_layer_nsfw.py to load the image using OpenCV. My extracted matrix is not even close. I get why Emmanual suggested transform_param {
scale: 0.004
}
rperdon
@rperdon
Oct 24 2017 18:48
Using the classify.py code from the classification example for Digits, I was able to load the image and classify the image using OpenCV in addition to PIL. When I printed the numpy array being loaded via PIL.Image.open versus cvs.imread, I found that the PIL matrix included a transparency channel. Other than that, the OpenCV with BGR inversion and PIL matrices matched.
When compared to each other, the resulting classifications matched digit for digit for the same test image.
cchadowitz-pf
@cchadowitz-pf
Oct 24 2017 19:25
awesome - but you haven't found the same when using the extract_layer_nsfw.py script, modified similarly, correct?