Samples count per sent block

Come here to discuss about OpenViBE in general!
Post Reply
karthiks
Posts: 78
Joined: Thu Sep 02, 2010 2:43 pm
Location: Université Libre de Bruxelles

Samples count per sent block

Post by karthiks »

Hey,

Is it possible to just get 1 sample per sent buffer? Where do I change it in the acquisition server code?

PS: not sure if this is the correct place to post it, so please change to a better location, if applicable :)
Regards,

Karthik

yrenard
Site Admin
Posts: 645
Joined: Fri Sep 01, 2006 3:39 pm
Contact:

Re: Samples count per sent block

Post by yrenard »

Dear karthiks,

there are two ways of doing this :
  • editing the .ui file of the acquisition server GUI to add 1 as a possible option
  • configuring a Time Based Epoching box so that it selects 1-sample wide epochs.
However, the smaller the number of sample per block, the more blocks have to be processed. This is time consuming as there is an overhead for encoding / decoding / transport of chunks in the kernel & plugins. If you don't have very low sampling frequency and are working with EEG, I don't recommend to do this and I suggest you give us more details about your problem so we can propose a better solution.

Hope this helps,
Yann

karthiks
Posts: 78
Joined: Thu Sep 02, 2010 2:43 pm
Location: Université Libre de Bruxelles

Re: Samples count per sent block

Post by karthiks »

Dear Yann,

The problem lies in the neural network I have implemented. If I use it in offline mode, it reads one line of data from the file (1 sample per buffer in the .csv reader) and predicts quite nicely. the moment I switch it to online mode, it gets overwhelmed by the amount of data coming in (4 samples per block) and prediction stops.

Regards,

Karthik
yrenard wrote:Dear karthiks,

there are two ways of doing this :
  • editing the .ui file of the acquisition server GUI to add 1 as a possible option
  • configuring a Time Based Epoching box so that it selects 1-sample wide epochs.
However, the smaller the number of sample per block, the more blocks have to be processed. This is time consuming as there is an overhead for encoding / decoding / transport of chunks in the kernel & plugins. If you don't have very low sampling frequency and are working with EEG, I don't recommend to do this and I suggest you give us more details about your problem so we can propose a better solution.

Hope this helps,
Yann

yrenard
Site Admin
Posts: 645
Joined: Fri Sep 01, 2006 3:39 pm
Contact:

Re: Samples count per sent block

Post by yrenard »

Can't you handle samples one at a time event if they got to your box by 4 ?

Yann

karthiks
Posts: 78
Joined: Thu Sep 02, 2010 2:43 pm
Location: Université Libre de Bruxelles

Re: Samples count per sent block

Post by karthiks »

yrenard wrote:Can't you handle samples one at a time event if they got to your box by 4 ?

Yann
You mean to say I read the buffer one line at a time even when it reaches in 4? Won't that cause a overflow and slow things down?
Regards,

Karthik

yrenard
Site Admin
Posts: 645
Joined: Fri Sep 01, 2006 3:39 pm
Contact:

Re: Samples count per sent block

Post by yrenard »

Dear karthiks,

I did not mean that, I mean each time you receive a block of 4, you iterate 4 times inside your box on each sample so your algorithm continues working with only 1 sample each time.

Was it clear ?

Yann

karthiks
Posts: 78
Joined: Thu Sep 02, 2010 2:43 pm
Location: Université Libre de Bruxelles

Re: Samples count per sent block

Post by karthiks »

yrenard wrote:Dear karthiks,

I did not mean that, I mean each time you receive a block of 4, you iterate 4 times inside your box on each sample so your algorithm continues working with only 1 sample each time.

Was it clear ?

Yann
Dear Yann,

does the openvibe architecture allow me to that? I thought it was a straight loop. :(

I have attached my scenario. If I implement what you say, I think I will have to modify my DRNN box code so that the prediction part is done 4 times. Will that not increase the computation time leading to non-realtime scenario?

Thanks for the help.

Regards,

Karthik
Attachments
OV-Scenario.JPG
OV-Scenario.JPG (21.26 KiB) Viewed 11478 times

yrenard
Site Admin
Posts: 645
Joined: Fri Sep 01, 2006 3:39 pm
Contact:

Re: Samples count per sent block

Post by yrenard »

Dear karthiks,

you missed my point but maybe I didn't get the problem either.

As far as I understand, your DRNN box is set-up to consider 1 sample at a time. On the first hand, when you read a CSV file, your are allowed to send samples 1 by 1. On the other hand when you get read signals from the acquisition server, you are not allowed to do that and can only go down to 4 samples per block (this is anyway easy to change if you want to test). Considering this, I see to options :
  • you want to process each of the 4 samples of the box individually
Then your box should include code like this :

Code: Select all

for(uint32 i=0; i<samlples_per_block; i++)
{
    do_it_like_when_you_had_one_sample(sample_i)
}
The scenario should not be changed in this case.
  • or you want to process only one sample for this chunk
In this case, either select the 1st sample (this does not change the scenario), or use downsampling to reduce the block to only 1 sample (means changing the scenario).

Yann

karthiks
Posts: 78
Joined: Thu Sep 02, 2010 2:43 pm
Location: Université Libre de Bruxelles

Re: Samples count per sent block

Post by karthiks »

yrenard wrote:Dear karthiks,

you missed my point but maybe I didn't get the problem either.

As far as I understand, your DRNN box is set-up to consider 1 sample at a time. On the first hand, when you read a CSV file, your are allowed to send samples 1 by 1. On the other hand when you get read signals from the acquisition server, you are not allowed to do that and can only go down to 4 samples per block (this is anyway easy to change if you want to test). Considering this, I see to options :
  • you want to process each of the 4 samples of the box individually
Then your box should include code like this :

Code: Select all

for(uint32 i=0; i<samlples_per_block; i++)
{
    do_it_like_when_you_had_one_sample(sample_i)
}
The scenario should not be changed in this case.
  • or you want to process only one sample for this chunk
In this case, either select the 1st sample (this does not change the scenario), or use downsampling to reduce the block to only 1 sample (means changing the scenario).

Yann
Dear Yann,

Sorry for not communicating properly. Thank you for clarifying the possible solutions.

I was also thinking the same thing that you have suggested in the box - to do the loop and read each of the samples. My only worry was that it would increase computational time to such an extent that the scenario will cease to be real time. Is that a possibility?

Karthik

yrenard
Site Admin
Posts: 645
Joined: Fri Sep 01, 2006 3:39 pm
Contact:

Re: Samples count per sent block

Post by yrenard »

That mostly depends on your algorithm, only you can answer this ;)
Yann

karthiks
Posts: 78
Joined: Thu Sep 02, 2010 2:43 pm
Location: Université Libre de Bruxelles

Re: Samples count per sent block

Post by karthiks »

Dear Yann,

Is it possible to hold the buffer in memory? What I mean to ask is - Is the buffer cleared at the end of each loop? and can i hold the buffer in a variable such that it is present even when the next buffer comes in?

Regards,

KS

jlegeny
Posts: 239
Joined: Tue Nov 02, 2010 8:51 am
Location: Mensia Technologies Paris FR
Contact:

Re: Samples count per sent block

Post by jlegeny »

If you define any members in your box then they will be persistent and hold any data you put into them. You can create a buffer holding as many values as you want, but beware of the memory consumption and overflows.

Post Reply