Mercurial > hg > audiodb
changeset 471:add65705e655
added --no_unit_norming to SOAP interface, added this case to tests/0041
author | mas01mc |
---|---|
date | Tue, 06 Jan 2009 07:02:11 +0000 |
parents | 51d02229288f |
children | f9d86b1db21c e7c7caa25e6d |
files | audioDB.h audioDBws.h soap.cpp tests/0041/run-test.sh |
diffstat | 4 files changed, 34 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/audioDB.h Wed Dec 31 14:08:43 2008 +0000 +++ b/audioDB.h Tue Jan 06 07:02:11 2009 +0000 @@ -62,6 +62,7 @@ #define COM_ABSOLUTE_THRESH "--absolute-threshold" #define COM_EXHAUSTIVE "--exhaustive" #define COM_LSH_EXACT "--lsh_exact" +#define COM_NO_UNIT_NORMING "--no_unit_norming" // Because LSH returns NN with P(1)<1 we want to return exact // points above this boundary.
--- a/audioDBws.h Wed Dec 31 14:08:43 2008 +0000 +++ b/audioDBws.h Tue Jan 06 07:02:11 2009 +0000 @@ -66,10 +66,10 @@ int adb__liszt(xsd__string dbName, xsd__int lisztOffset, xsd__int lisztLength, struct adb__lisztResponse &adbLisztResponse); // Query an existing adb database -int adb__query(xsd__string dbName, xsd__string qKey, xsd__string keyList, xsd__string timesFileName, xsd__string powerFileName, xsd__int qType, xsd__int qPos, xsd__int pointNN, xsd__int segNN, xsd__int segLen, xsd__double radius, xsd__double absolute_threshold, xsd__double relative_threshold, xsd__int exhaustive, xsd__int lsh_exact, struct adb__queryResponse &adbQueryResponse); +int adb__query(xsd__string dbName, xsd__string qKey, xsd__string keyList, xsd__string timesFileName, xsd__string powerFileName, xsd__int qType, xsd__int qPos, xsd__int pointNN, xsd__int segNN, xsd__int segLen, xsd__double radius, xsd__double absolute_threshold, xsd__double relative_threshold, xsd__int exhaustive, xsd__int lsh_exact, xsd__int no_unit_norming, struct adb__queryResponse &adbQueryResponse); -int adb__sequenceQueryByKey(xsd__string dbName,xsd__string trackKey, xsd__string featureFileName, xsd__int queryType,xsd__string trackFileName,xsd__string timesFileName,xsd__int queryPoint,xsd__int pointNN,xsd__int trackNN,xsd__int sequenceLength,xsd__double radius,xsd__double absolute_threshold,xsd__int usingQueryPoint,xsd__int lsh_exact,struct adb__queryResponse &adbQueryResponse); +int adb__sequenceQueryByKey(xsd__string dbName,xsd__string trackKey, xsd__string featureFileName, xsd__int queryType,xsd__string trackFileName,xsd__string timesFileName,xsd__int queryPoint,xsd__int pointNN,xsd__int trackNN,xsd__int sequenceLength,xsd__double radius,xsd__double absolute_threshold,xsd__int usingQueryPoint,xsd__int lsh_exact, xsd__int no_unit_norming, struct adb__queryResponse &adbQueryResponse); // Query an audioDB database by vector (serialized), queryKey/featureFileName is here replaced with qVector -int adb__shingleQuery(xsd__string dbName, struct adb__queryVector qVector, xsd__string keyList, xsd__string timesFileName, xsd__int queryType, xsd__int queryPos, xsd__int pointNN, xsd__int trackNN, xsd__int sequenceLength, xsd__double radius, xsd__double absolute_threshold, xsd__double relative_threshold, xsd__int exhaustive, xsd__int lsh_exact, struct adb__queryResponse &adbQueryResponse); +int adb__shingleQuery(xsd__string dbName, struct adb__queryVector qVector, xsd__string keyList, xsd__string timesFileName, xsd__int queryType, xsd__int queryPos, xsd__int pointNN, xsd__int trackNN, xsd__int sequenceLength, xsd__double radius, xsd__double absolute_threshold, xsd__double relative_threshold, xsd__int exhaustive, xsd__int lsh_exact, xsd__int no_unit_norming, struct adb__queryResponse &adbQueryResponse);
--- a/soap.cpp Wed Dec 31 14:08:43 2008 +0000 +++ b/soap.cpp Tue Jan 06 07:02:11 2009 +0000 @@ -55,7 +55,7 @@ queryType, queryPoint, pointNN, trackNN, sequenceLength, radius, absolute_threshold, relative_threshold, - !usingQueryPoint, lsh_exact, + !usingQueryPoint, lsh_exact, no_unit_norming, adbQueryResponse) == SOAP_OK) { if(radius == 0) { @@ -115,7 +115,8 @@ radius, absolute_threshold, usingQueryPoint, - lsh_exact, + lsh_exact, + no_unit_norming, adbQueryResponse)==SOAP_OK){ //std::std::cerr << "result list length:" << adbQueryResponse.result.__sizeRlist << std::std::endl; for(int i=0; i<adbQueryResponse.result.__sizeRlist; i++) @@ -180,7 +181,7 @@ xsd__int seqLen, xsd__double radius, xsd__double absolute_threshold, xsd__double relative_threshold, - xsd__int exhaustive, xsd__int lsh_exact, + xsd__int exhaustive, xsd__int lsh_exact, xsd__int no_unit_norming, adb__queryResponse &adbQueryResponse){ char queryType[256]; @@ -237,6 +238,10 @@ argc++; } + if(no_unit_norming){ + argc++; + } + const char **argv = new const char*[argc+1]; argv[0] = "./audioDB"; argv[1] = COM_QUERY; @@ -280,6 +285,11 @@ if (lsh_exact) { argv[argv_counter++] = COM_LSH_EXACT; } + + if (no_unit_norming) { + argv[argv_counter++] = COM_NO_UNIT_NORMING; + } + argv[argv_counter] = NULL; try { @@ -306,11 +316,11 @@ xsd__double radius, xsd__double absolute_threshold, xsd__int usingQueryPoint, - xsd__int lsh_exact, + xsd__int lsh_exact, xsd__int no_unit_norming, struct adb__queryResponse& adbQueryResponse){ char qtypeStr[256]; - fprintf(stderr, "Calling %s query on database %s with %s=%s\n", (trackKey&&strlen(trackKey))?"KEY":"FILENAME", dbName, (trackKey&&strlen(trackKey))?"KEY":"FILENAME",(trackKey&&strlen(trackKey))?trackKey:featureFileName); + fprintf(stderr, "Calling %s query on database %s with %s=%s, distFun:%s\n", (trackKey&&strlen(trackKey))?"KEY":"FILENAME", dbName, (trackKey&&strlen(trackKey))?"KEY":"FILENAME",(trackKey&&strlen(trackKey))?trackKey:featureFileName, no_unit_norming?"Euclidean":"Normed Euclidean"); INTSTRINGIFY(queryPoint, qPosStr); INTSTRINGIFY(pointNN, pointNNStr); @@ -319,8 +329,6 @@ DOUBLESTRINGIFY(absolute_threshold, absolute_thresholdStr); DOUBLESTRINGIFY(radius, radiusStr); - // WS queries only support 1-nearest neighbour point reporting - // at the moment, until we figure out how to better serve results snprintf(qtypeStr, 256, "nsequence"); const char *argv[]={ "./audioDB", @@ -344,10 +352,11 @@ seqLenStr, COM_ABSOLUTE_THRESH, absolute_thresholdStr, - lsh_exact?COM_LSH_EXACT:"" + lsh_exact?COM_LSH_EXACT:"", + no_unit_norming?COM_NO_UNIT_NORMING:"", }; - const unsigned argc = 22; + const unsigned argc = 23; try { @@ -360,7 +369,7 @@ } // Query an audioDB database by vector (serialized) -int adb__shingleQuery(struct soap* soap, xsd__string dbName, struct adb__queryVector qVector, xsd__string keyList, xsd__string timesFileName, xsd__int queryType, xsd__int queryPos, xsd__int pointNN, xsd__int trackNN, xsd__int sequenceLength, xsd__double radius, xsd__double absolute_threshold, xsd__double relative_threshold, xsd__int exhaustive, xsd__int lsh_exact, struct adb__queryResponse &adbQueryResponse){ +int adb__shingleQuery(struct soap* soap, xsd__string dbName, struct adb__queryVector qVector, xsd__string keyList, xsd__string timesFileName, xsd__int queryType, xsd__int queryPos, xsd__int pointNN, xsd__int trackNN, xsd__int sequenceLength, xsd__double radius, xsd__double absolute_threshold, xsd__double relative_threshold, xsd__int exhaustive, xsd__int lsh_exact, xsd__int no_unit_norming, struct adb__queryResponse &adbQueryResponse){ // open a tmp file on the server, write shingle, query as a file with query point 0 // and shingle length l/dim @@ -422,7 +431,7 @@ int retVal = adb__query(soap, dbName, tmpFileName, keyList, timesFileName, qVector.__sizep?tmpFileName2:0, queryType, queryPos, pointNN, trackNN, sequenceLength, radius, - absolute_threshold, relative_threshold, exhaustive, lsh_exact, adbQueryResponse); + absolute_threshold, relative_threshold, exhaustive, lsh_exact, no_unit_norming, adbQueryResponse); return retVal; }
--- a/tests/0041/run-test.sh Wed Dec 31 14:08:43 2008 +0000 +++ b/tests/0041/run-test.sh Tue Jan 06 07:02:11 2009 +0000 @@ -81,6 +81,16 @@ echo testfeature 1 > test-expected-output cmp testoutput test-expected-output +# make index, no_unit_norming +# Index with default LSH params +${AUDIODB} -d testdb -X -l 1 -R 0.9 --lsh_k 1 --no_unit_norming + +${AUDIODB} -c localhost:${WSPORT} -d testdb -Q nsequence -l 1 -f testquery -w testpower -p 0 -R 0.9 -n 2 --no_unit_norming --lsh_exact > testoutput +echo testfeature 3 > test-expected-output +echo testfeature 0 >> test-expected-output +cmp testoutput test-expected-output + + stop_server $! exit 104