CogniMem API?

54 views
Skip to first unread message

elias

unread,
Sep 17, 2008, 7:06:11 AM9/17/08
to CogniMem-Users
I am having some trouble with the CogniMem API, can any one tell why
the example below wont work?
/////////////////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "cognimem.h"
#include <stdio.h>

int main(int argc, char* argv[]){
int NeuronNbr;
word test1[] = {0,1,2,3,4,5,6,7,8,9};
word test2[] = {0,1,2,3,4,5,6,7,8,9};

if(CM_Open(1)!=0)return(1);
NeuronNbr=CM_Init();
printf("Hello Brain! you have %d Neurons!\n", NeuronNbr);
//Learn test1
for(int i=0; i<9; i++){CM_Write(CM_COMP, test1[i]);}
CM_Write(CM_LCOMP, test1[9]);
CM_Write(CM_CAT, 2);
printf("NCOUNT: %u\n", CM_Read(CM_NCOUNT));
printf("Press any key to continue...\n");
getch();
//Recognize test2
for(int i =0; i<9; i++){CM_Write(CM_COMP, test2[i]);}
CM_Write(CM_LCOMP, test2[9]);
printf("test2:\n\tDIST: %u\n\tCAT: %u\n\tNSR: %u\n",
CM_Read(CM_DIST),
CM_Read(CM_CAT),
CM_Read(CM_NSR));
printf("Press any key to continue...\n");
getch();
CM_Close();
return 0;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
<output>
Hello Brain! you have 1024 Neurons!
NCOUNT: 1
Press any key to continue...
test2:
DIST: 65535
CAT: 2
NSR: 8
</output>

Anne Menendez

unread,
Sep 18, 2008, 11:26:39 AM9/18/08
to Cogn...@googlegroups.com, robin....@roadnarrows.com
Looking at the example code below...
Indeed the distance value should be 0 since the vector to recognize is the
same as the one learned.
I believe the error comes from the call of the printf command. If you change
the example slightly as follow the displayed distance value is 0.

a=CM_Read(CM_DIST);
b=CM_Read(CM_CAT);
c=CM_Read(CM_NSR);
printf("test2: \n\tDIST: %u\n\tCAT: %u\n\tNSR: %u\n",a,b,c);

Good luck
Anne

elias

unread,
Sep 23, 2008, 3:50:38 AM9/23/08
to CogniMem-Users
Dear Anne

Thanks for your answer. I did what you suggested, and the distance
certainly got smaller, but still not 0(the distance changes every
run). I am quite puzzled by this, and could very much use some help
getting started with this.

/Elias

Anne Menendez

unread,
Sep 23, 2008, 12:20:24 PM9/23/08
to Cogn...@googlegroups.com
Dear Elias,

Can you try the example supplied in the attachment. It is basically an
extension of your original code packaged with the latest cognimem.lib and
header. I also inluded the latest DLL you may want to copy on
Windows\System32.
If it still does not work, can you verify if you have the same symptoms
whether you call CM_Open with the platform 0 (for simu) or 1 (for CM-EB).
Also check if the SimpleExample supplied on the CD under Demos behaves the
same (it calls the same CogniMem.dll but is written in Visual Basic).

Good luck and keep me posted.
CM_SimpleExample_C++.zip

Elias G. Schneevoigt

unread,
Sep 23, 2008, 2:09:02 PM9/23/08
to Cogn...@googlegroups.com
Dear Anne

I tried your example program, and it works fine in simulation mode, but behaves the same way as with the old dll/lib when ran on hardware. The SimpleExample from the CD works fine, but isn't it running in simulation mode aswell? The Easy_Video_Trainer also seems to work fine.

/Elias

2008/9/23 Anne Menendez <an...@general-vision.com>



--
________________________
Elias G. Schneevoigt
Sankt Nicolai Gade 2A, 2.tv.
5700 Svendborg
Tlf.: 62 20 22 25
Mobil: 60 66 60 76

elias

unread,
Sep 23, 2008, 5:04:59 PM9/23/08
to CogniMem-Users
By the way, im using Microsoft Visual C++ 2008 Express Edition. Maybe
this is the problem?

/Elias

On Sep 23, 8:09 pm, "Elias G. Schneevoigt" <elias....@gmail.com>
wrote:
> Dear Anne
>
> I tried your example program, and it works fine in simulation mode, but
> behaves the same way as with the old dll/lib when ran on hardware. The
> SimpleExample from the CD works fine, but isn't it running in simulation
> mode aswell? The Easy_Video_Trainer also seems to work fine.
>
> /Elias
>
> 2008/9/23 Anne Menendez <a...@general-vision.com>

elias

unread,
Sep 26, 2008, 6:22:52 AM9/26/08
to CogniMem-Users
Dear Anne

Have you given up on me? Time is not on my side, so please advice!

Best regards
Elias

Anne Menendez

unread,
Sep 26, 2008, 10:57:24 AM9/26/08
to Cogn...@googlegroups.com, Guy Paillet
Hi Elias,

Sorry for the delay. I do not have Visual C++2008 indeed. I have the
following suggestions:
- 1) Can you modify your example to detect if the problem is specific to the
CM_DIST register or to the 1st register that you read out? For example try
CM_Read(CM_NSR) prior to reading CM_DIST.
- 2) What are the returned value a, b,c (in debug mode for example) prior
to the prinf command

Let me know what you observe. I may try to download VC++ 2008 on a spare PC
this week-end.

elias

unread,
Sep 26, 2008, 11:32:14 AM9/26/08
to CogniMem-Users
Hi Anne,

It's not just the first register.. Here is the detailed output of the
CM_SimpleExamle_C++ test program you send me(it is not at all
consistent though) :
<output mode="simulation">
Hello Brain! you have 2048 Neurons!
Press any key to continue...
Learning of Vector1 and Vector2. NCOUNT= 2
Press any key to continue...
Recognition of Vector1 (identified)
DIST: 0
CAT: 1
NSR: 8
Press any key to continue...
Recognition of Vector3 (uncertain)
DIST1: 10 CAT1: 1
DIST2: 20 CAT2: 2
NSR: 4
Press any key to continue...
Recognition of Vector4 (unknown)
DIST: 65535
CAT: 65535
NSR: 0
</output>
<output mode="hardware">
Hello Brain! you have 1024 Neurons!
Press any key to continue...
Learning of Vector1 and Vector2. NCOUNT= 2
Press any key to continue...
Recognition of Vector1 (identified)
DIST: 8
CAT: 65535
NSR: 0
Press any key to continue...
Recognition of Vector3 (uncertain)
DIST1: 4 CAT1: 1
DIST2: 65535 CAT2: 65535
NSR: 0
Press any key to continue...
Recognition of Vector4 (unknown)
DIST: 65535
CAT: 65535
NSR: 0
</output>

/Elias

Anne Menendez

unread,
Sep 26, 2008, 1:35:03 PM9/26/08
to Cogn...@googlegroups.com
Hi Elias,

This is weird indeed. Unless another suscriber of the CogniMem's User Group
has something to comment about this VC++ 2008 issue, I suggest that we
pursue this discussion directly between us and we will post a final message
when we have solved this technical issue.

In the mean time, I will look for a spare PC to install VC++2008.

Elias G. Schneevoigt

unread,
Sep 26, 2008, 1:46:50 PM9/26/08
to Cogn...@googlegroups.com
Hi Anne

That's fine by me. You can mail me directly. You call it a VC++ 2008 issue, what IDE did you have in mind for developing with the CogniMem API?

/Elias


2008/9/26 Anne Menendez <an...@general-vision.com>

RoyS

unread,
Sep 27, 2008, 6:10:18 AM9/27/08
to CogniMem-Users
I certainly do not need to know every piece of your discussion, but I
am very interested in the conclusion. Thanks in advance for posting
the final message.

On Sep 26, 12:46 pm, "Elias G. Schneevoigt" <elias....@gmail.com>
wrote:
> Hi Anne
>
> That's fine by me. You can mail me directly. You call it a VC++ 2008 issue,
> what IDE did you have in mind for developing with the CogniMem API?
>
> /Elias
>
> 2008/9/26 Anne Menendez <a...@general-vision.com>

Anne Menendez

unread,
Sep 27, 2008, 2:47:23 PM9/27/08
to Cogn...@googlegroups.com
Hi Elias,
 
It works for me!
I downloaded Microsoft Visual C++ 2008 Express Edition this morning, opened CM_SimpleExample_C++ and accepted the conversion of the project from VC++ version 6.0. The results are correct using platform=0 and platform=1. See the screenshot attached.
 
PS: I assumed from the beginning that you have run the Diagnostics utility supplied on CD with the hardware, in particular the Test Neurons function. Can you verify that it passes? If so, you can open the Advanced menu and execute the sequence of Read/Write commands as in the Simple Example. if this works, you will know that the problem definitely comes from your VC++ 2008 configuration. If not, the board has a problem.
 
Good luck. Anne
 
VC2008SimpleExampleCM_IR.JPG

Elias G. Schneevoigt

unread,
Sep 27, 2008, 3:56:55 PM9/27/08
to Cogn...@googlegroups.com
Hi Anne

This is weird. The chip passes all the tests in the Diagnostics utility. I have compiled and executed your SimpleExample_C++ on two different computers, so I don't think its my VC++ 2008 causing this - did you make any changes to the default settings of your VC++ 2008 configuration?

/Elias

2008/9/27 Anne Menendez <an...@general-vision.com>

Anne Menendez

unread,
Sep 29, 2008, 11:30:13 AM9/29/08
to Cogn...@googlegroups.com
Elias,
 
VC++2008 was installed with default settings. I guess we need to hear from other users running VC++ 2008. Anybody there?
 
Anne

elias

unread,
Sep 30, 2008, 1:59:59 PM9/30/08
to CogniMem-Users
Hi Anne

Well, it seems that running the diagnostic utility kind of jump
started our second chip, so that one seems to work now. I have run
into another problem regarding the CogniMem API though.

I can't seem to get access to the functions in the GVImage.dll.
Perhaps some one would be so kind as to help me with this? (Maybe this
calls for another thread?) I have tried the following:

1) included the GVImage.h.
2) loading the dll directly using windows LoadLibrary function

/Elias

On Sep 29, 5:30 pm, "Anne Menendez" <a...@general-vision.com> wrote:
> Elias,
>
> VC++2008 was installed with default settings. I guess we need to hear from
> other users running VC++ 2008. Anybody there?
>
> Anne
>
> -----Original Message-----
> From: Cogn...@googlegroups.com [mailto:Cogn...@googlegroups.com] On Behalf
>
> Of Elias G. Schneevoigt
> Sent: Saturday, September 27, 2008 12:57 PM
> To: Cogn...@googlegroups.com
> Subject: Re: CogniMem API?
>
> Hi Anne
>
> This is weird. The chip passes all the tests in the Diagnostics utility. I
> have compiled and executed your SimpleExample_C++ on two different
> computers, so I don't think its my VC++ 2008 causing this - did you make any
> changes to the default settings of your VC++ 2008 configuration?
>
> /Elias
>
> 2008/9/27 Anne Menendez <a...@general-vision.com>

Anne Menendez

unread,
Sep 30, 2008, 2:11:42 PM9/30/08
to Cogn...@googlegroups.com
Elias,

You also need to link gvimage.lib and jpeg.lib to your project.

Anne

-----Original Message-----
From: Cogn...@googlegroups.com [mailto:Cogn...@googlegroups.com] On Behalf
Of elias
Sent: Tuesday, September 30, 2008 11:00 AM
To: CogniMem-Users
Subject: Re: CogniMem API?



Hi Anne

Well, it seems that running the diagnostic utility kind of jump started our
second chip, so that one seems to work now. I have run into another problem
regarding the CogniMem API though.

I can't seem to get access to the functions in the GVImage.dll. Perhaps some
one would be so kind as to help me with this? (Maybe this calls for another
thread?) I have tried the following:

1) included the GVImage.h.
2) loading the dll directly using windows LoadLibrary function

/Elias

On Sep 29, 5:30 pm, "Anne Menendez" <a...@general-vision.com> wrote:
> Elias,
>
> VC++2008 was installed with default settings. I guess we need to hear
> VC++from

Elias G. Schneevoigt

unread,
Sep 30, 2008, 2:32:33 PM9/30/08
to Cogn...@googlegroups.com
Hi Anne

Thanks for your quick reply! Where do I find these?

/Elias

2008/9/30 Anne Menendez <an...@general-vision.com>

Anne Menendez

unread,
Sep 30, 2008, 4:25:35 PM9/30/08
to Cogn...@googlegroups.com
The two lib are in the Lib folder of the Developer's Kit (CM_EB_SDK).

Elias G. Schneevoigt

unread,
Sep 30, 2008, 4:31:04 PM9/30/08
to Cogn...@googlegroups.com
Ok, this is not something I can find on your webpage, not even in RN.V1.1_CogniMemCD.zip. I cant read your small sized CD in my macbook, if thats where you mean - so could you please send these files to me?!

Anne Menendez

unread,
Sep 30, 2008, 4:57:58 PM9/30/08
to Cogn...@googlegroups.com
Elias,
 
I will let Road Narrows do that (I have notified them already and am sure you will see an update on their web shortly)
Reply all
Reply to author
Forward
0 new messages