Discussion:
Mahotas LBP giving different outputs on different runs
Somtirtha Roy
2013-11-08 21:19:37 UTC
Permalink
Hi,

I am working on videos and extracting LBP features from different frames of
the video. But each time I run my code it gives a different set of outputs.
I was wondering if anybody faced this problem and if there is any
explanation of mahotas behaving in such a way.

P.S.: I have run it on images and it gives consistent outputs. The frames
from the video are also consistent on different runs, hence my question on
mahotas.

Thanks,
--
You received this message because you are subscribed to the Google Groups "pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonvision+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Luis Pedro Coelho
2013-11-09 14:55:53 UTC
Permalink
Post by Somtirtha Roy
Hi,
I am working on videos and extracting LBP features from different frames
of the video. But each time I run my code it gives a different set of
outputs.
I was wondering if anybody faced this problem and if there is any
explanation of mahotas behaving in such a way.
This is a bug in mahotas, obviously; LBP should be deterministic.
Post by Somtirtha Roy
P.S.: I have run it on images and it gives consistent outputs. The
frames from the video are also consistent on different runs, hence my
question on mahotas.
So, if you extract the frames as images and run mahotas on the frames
twice you get different results?

Is there any chance you can isolate a test case and publish it?

Tx.
--
Luis Pedro Coelho | EMBL | http://luispedro.org

Recent stuff:
http://dx.doi.org/10.5334/jors.ac
http://bit.ly/coelho2013-video
http://bit.ly/general-subcellular-determination
--
You received this message because you are subscribed to the Google Groups "pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonvision+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Somtirtha Roy
2013-11-09 17:22:49 UTC
Permalink
Post by Luis Pedro Coelho
Post by Somtirtha Roy
Hi,
I am working on videos and extracting LBP features from different frames
of the video. But each time I run my code it gives a different set of
outputs.
I was wondering if anybody faced this problem and if there is any
explanation of mahotas behaving in such a way.
This is a bug in mahotas, obviously; LBP should be deterministic.
Post by Somtirtha Roy
P.S.: I have run it on images and it gives consistent outputs. The
frames from the video are also consistent on different runs, hence my
question on mahotas.
So, if you extract the frames as images and run mahotas on the frames
twice you get different results?
Is there any chance you can isolate a test case and publish it?
Tx.
--
Luis Pedro Coelho | EMBL | http://luispedro.org
http://dx.doi.org/10.5334/jors.ac
http://bit.ly/coelho2013-video
http://bit.ly/general-subcellular-determination
Hi Luis,

Yes I am extracting the frames as images while reading a video and running
mahotas LBP on it and then printing the results.
It does give different results on different runs.

I will try and compile a test case for your purpose.

Thanks,
--
You received this message because you are subscribed to the Google Groups "pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonvision+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Somtirtha Roy
2013-12-15 20:28:56 UTC
Permalink
Post by Somtirtha Roy
Post by Somtirtha Roy
Post by Somtirtha Roy
Hi,
I am working on videos and extracting LBP features from different
frames
Post by Somtirtha Roy
of the video. But each time I run my code it gives a different set of
outputs.
I was wondering if anybody faced this problem and if there is any
explanation of mahotas behaving in such a way.
This is a bug in mahotas, obviously; LBP should be deterministic.
Post by Somtirtha Roy
P.S.: I have run it on images and it gives consistent outputs. The
frames from the video are also consistent on different runs, hence my
question on mahotas.
So, if you extract the frames as images and run mahotas on the frames
twice you get different results?
Is there any chance you can isolate a test case and publish it?
Tx.
--
Luis Pedro Coelho | EMBL | http://luispedro.org
http://dx.doi.org/10.5334/jors.ac
http://bit.ly/coelho2013-video
http://bit.ly/general-subcellular-determination
Hi Luis,
Yes I am extracting the frames as images while reading a video and running
mahotas LBP on it and then printing the results.
It does give different results on different runs.
I will try and compile a test case for your purpose.
Thanks,
Hi Luis,

Sorry for the delay. I am attaching the test case which shows the erratic
behaviour of mahotas LBP. The zip file has the following:
1) My test program.
2) The test video I ran on.
3) Two sets of results each of running it on 400 frames, 100 frames and all
the frames in the video.
4) A Lenna image.
5) A log file containing the results of running it on the Lenna image
multiple times.

The results from 400 frames show no difference in result but the results of
consecutive runs on 100 frames and on the whole video show varied results
(I tried the diff command to check).

Also the log file has results of running the lbp code on the image multiple
times and the differences between two successive calls. It shows
inconsistency at intervals.

Thanks you for your time. Let me know if you need anything else.
--
You received this message because you are subscribed to the Google Groups "pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonvision+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Luis Pedro Coelho
2013-12-16 11:25:28 UTC
Permalink
Post by Somtirtha Roy
Sorry for the delay. I am attaching the test case which shows the
1) My test program.
2) The test video I ran on.
3) Two sets of results each of running it on 400 frames, 100 frames and
all the frames in the video.
4) A Lenna image.
5) A log file containing the results of running it on the Lenna image
multiple times.
The results from 400 frames show no difference in result but the results
of consecutive runs on 100 frames and on the whole video show varied
results (I tried the diff command to check).
Thanks. I will have a look to see if I can reproduce/fix this behaviour.

It's certainly puzzling. My guess is some weird memory access bug, but
I'll get back to you when I have something more solid.

Luis
--
Luis Pedro Coelho | EMBL | http://luispedro.org

Recent stuff:
http://dx.doi.org/10.1038/nmeth.2693
http://dx.doi.org/10.5334/jors.ac
http://dx.doi.org/10.1093/bioinformatics/btt392
--
You received this message because you are subscribed to the Google Groups "pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonvision+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Luis Pedro Coelho
2013-12-16 13:45:17 UTC
Permalink
Ok, got it and fixed it on mahotas side.

The problem was that (1) you are trying to compute LBPs on an RGB image,
for which they are not defined. However, (2) mahotas did not check for
this and would just happily try to perform interpolation along two
dimensions on 3 dimensional images and (3) it would access a
non-allocated memory location.

I fixed (2) and (3) above. In the github mahotas, you'll get a clear
error message about this issue. You still need to fix (1), however.

§

LBPs should be computed on a greyscale image. Adding the line

frameImg = mahotas.colors.rgb2gray(frameImg)

just before the lbp() call does it.

(depending on your usage, it may be more appropriate to use another
colourspace, check out
http://mahotas.readthedocs.org/en/latest/api.html#module-mahotas.colors
for ideas)

§

Thanks for the excellent report & test cases.

HTH
Luis
Post by Luis Pedro Coelho
Post by Somtirtha Roy
Sorry for the delay. I am attaching the test case which shows the
1) My test program.
2) The test video I ran on.
3) Two sets of results each of running it on 400 frames, 100 frames and
all the frames in the video.
4) A Lenna image.
5) A log file containing the results of running it on the Lenna image
multiple times.
The results from 400 frames show no difference in result but the results
of consecutive runs on 100 frames and on the whole video show varied
results (I tried the diff command to check).
Thanks. I will have a look to see if I can reproduce/fix this behaviour.
It's certainly puzzling. My guess is some weird memory access bug, but
I'll get back to you when I have something more solid.
Luis
--
Luis Pedro Coelho | EMBL | http://luispedro.org

Recent stuff:
http://dx.doi.org/10.1038/nmeth.2693
http://dx.doi.org/10.5334/jors.ac
http://dx.doi.org/10.1093/bioinformatics/btt392
--
You received this message because you are subscribed to the Google Groups "pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonvision+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Somtirtha Roy
2013-12-18 06:27:51 UTC
Permalink
Hi Luis,

Thank you so much for your prompt reply. I am sorry for overlooking the
grayscale conversion. It works perfect now.
Also thanks for suggesting the mahotas color module. I am sure it will be
of a lot of help.

Sincerely,

*Somtirtha Roy*
*Graduate Student,*
*Electrical and Computer Engineering,*
*Colorado State University,*
*Fort Collins, Colorado, USA.*





*o__ _> /__(_) \(_) .... Go Green ... Start CyclingBurn Fat ... Not Fuel*
Post by Luis Pedro Coelho
Ok, got it and fixed it on mahotas side.
The problem was that (1) you are trying to compute LBPs on an RGB image,
for which they are not defined. However, (2) mahotas did not check for this
and would just happily try to perform interpolation along two dimensions on
3 dimensional images and (3) it would access a non-allocated memory
location.
I fixed (2) and (3) above. In the github mahotas, you'll get a clear error
message about this issue. You still need to fix (1), however.
§
LBPs should be computed on a greyscale image. Adding the line
frameImg = mahotas.colors.rgb2gray(frameImg)
just before the lbp() call does it.
(depending on your usage, it may be more appropriate to use another
colourspace, check out http://mahotas.readthedocs.
org/en/latest/api.html#module-mahotas.colors for ideas)
§
Thanks for the excellent report & test cases.
HTH
Luis
Post by Luis Pedro Coelho
Post by Somtirtha Roy
Sorry for the delay. I am attaching the test case which shows the
1) My test program.
2) The test video I ran on.
3) Two sets of results each of running it on 400 frames, 100 frames and
all the frames in the video.
4) A Lenna image.
5) A log file containing the results of running it on the Lenna image
multiple times.
The results from 400 frames show no difference in result but the results
of consecutive runs on 100 frames and on the whole video show varied
results (I tried the diff command to check).
Thanks. I will have a look to see if I can reproduce/fix this behaviour.
It's certainly puzzling. My guess is some weird memory access bug, but
I'll get back to you when I have something more solid.
Luis
--
Luis Pedro Coelho | EMBL | http://luispedro.org
http://dx.doi.org/10.1038/nmeth.2693
http://dx.doi.org/10.5334/jors.ac
http://dx.doi.org/10.1093/bioinformatics/btt392
--
You received this message because you are subscribed to a topic in the
Google Groups "pythonvision" group.
To unsubscribe from this topic, visit https://groups.google.com/d/
topic/pythonvision/ZQ0r9X0oYnA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonvision+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Loading...