jahuth / virtualretina

Bugfixes to the VirtualRetina Simulator of Adrien Wohrer
Other
7 stars 5 forks source link

about the spiking time? #9

Open Thanh-Binh opened 7 years ago

Thanh-Binh commented 7 years ago

I have just looked at the time instance of the generated spikes at mvaspike Root::get_instance()->get_t();

and would like to ask you:

  1. about the unit of tim? in microseconds or miliseconds?
  2. why the spikes do not have a sorted time instance? (that mean the next spikes may have a small timestamp than the previous ones) Thanks.
Thanh-Binh commented 6 years ago

I had an additional test on the number of spikes generated using my video and found an interesting phenomena, that the max. total number of spikes is limited by 320000. That means they are generated only by some first frames, not more and not less...

@jahuth how can we continue generating spikes as long as video runs?????

jahuth commented 6 years ago

The timestamp of the spikes should be a floating number in seconds, but I don't know if mvaspike does some internal conversion.

The issue with the order of the spikes comes from the fact that the spike generation is "event-driven". Most of the simulator works on a frame-by-frame basis, but when spikes are generated, the time point when the membrane potential reaches a threshold is interpolated between frames to give a more accurate spike time and allows for more than one spike to be generated in one frame. The order of the spikes depends on the order in which the neurons are evaluated.

For your second problem it is possible that the contrast in your images is scaled differently than VirtualRetina expects. There is a parameter that controls the expected luminance range and its default is to expect values between 0 and 255. Depending on how you load the video with openCV, your values might be between 0.0 and 1.0. This can still lead to spikes in the beginning of the movie, since there is a large change when the video starts, but afterwards the changes are too small to generate spikes. In your retina configuration file, you might want to change that value to 1.0. Also: is the number of spikes always exactly 320000? What happens when you use a larger or smaller video?

Cheers! Jacob

Thanh-Binh commented 6 years ago

About timestamp: I understood too that is event driven, but if your framework does not use multithreading so that the next spike shoud have a higher timestamp than the current spike. Am i right here?

About constant number of spikes: I will investigate on your recommendation and inform you tomorow.

Thanh-Binh commented 6 years ago

I have just tested by down scaling my frame images and found

  1. number of spikes is 320000 (the same as by original image resolution)
  2. The luminance value of my images is in the interval [0, 255]
jahuth commented 6 years ago

Hello Thanh-Binh!

The short answer to the timestamp is: you can see yourself that they are not ordered ;) The code processes one frame after the next, but in each frame one neuron after another. I will try to illustrate with a simplified example: If there are two cells at time 0.0s with a membrane potential of 0.0, while their threshold is 1.0, but their input is small for the first cell and large for the second, then the code will calculate the spike times first for the first cell and solve the differential equation for the membrane potential to find the time point when it crosses 1.0 (giving eg. a time of 0.002s). It then resets the membrane potential and integrates again, until it reaches the end of the frame. But if the second cell recieves a stronger input than the first, it will spike sooner (eg. at 0.001s). So you can have a slightly later spike that is saved before a slightly earlier spike. The time step is not synchronized across all cells until the next frame.

If the number of spikes always hits a ceiling of 320000, then its possible that there might be a bug, or at least a hard limit somewhere in the mvaspike code or the code that writes the text file. You could try to decrease the excitability of your cells, so that you get less spikes, or decrease the number of cells you have to get around that limit for a while. (Having less spikes is not necessarily a bad thing for your later processing) Can you tell me at which time point the spikes stop? Are they all within the first frame? How many different cells do you actually have in the image? If you went with the goal of adding a cell for each pixel, than in your video that would be 1280x720 = 921600 pixel. Do you have that many unique cells?

Cheers! Jacob

Thanh-Binh commented 6 years ago

Hi Jacob, My video has 752 x 480 pixels = 360.000 pixels. For every image frame i do N_rep=10 steps simulation. In my experiment, we have 120.000 spiking ganglion cells. Spikes are generated only in the 1st frame. The total number of spikes is 320.000 even by downscaling image size by 2. If i change N_rep from 10 to 1, no spike is generated. By N_rep=5, 100.000spikes are generated in the 1st frame. Is herr any bug of mvaspike?

Thanh-Binh commented 6 years ago

Jacob: do you have any idea for solving the problem that spikes are generated only at the 1st frame?

jahuth commented 6 years ago

Hello Thanh-Binh,

Sorry I didn't reply earlier, I was away.

On my code I just tried and computed a simulation with 2744688 spikes, so I think mva spike is working fine. Another likely cause could be that you are loading the first frame, but then somehow do not update the time. Could you make a fork of the repository and push there the changes you made to load videos via openCV?

Thank you! Jacob

Thanh-Binh commented 6 years ago

Hi Jacob, Hmm i do not understand why it goes false by me. I am so busy at the moment and will come back this topic soon next month. Thanks Binh

Gesendet mit der 1&1 Mail App

Am 07.08.17 um 17:51 schrieb jahuth

Hello Thanh-Binh,

Sorry I didn't reply earlier, I was away.

On my code I just tried and computed a simulation with 2744688 spikes, so I think mva spike is working fine. Another likely cause could be that you are loading the first frame, but then somehow do not update the time. Could you make a fork of the repository and push there the changes you made to load videos via openCV?

Thank you! Jacob

-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/jahuth/virtualretina/issues/9#issuecomment-320702540