Friday, August 29, 2014

Comparing strings

strcmp(var,'<string>')

Thursday, August 28, 2014

checking for a field in struct matlab

To check if stuct S has a field called 'fieldName', use:

isfield(S, 'fieldname')

Tuesday, August 19, 2014

Changes to run BING (objectness)

General changes to run on our servers:
-- In the objectness folder: change line 15:
from
set(OPENMP_FLAG "-fopenmp -std=c++11 -ftree-vectorize")
to
set(OPENMP_FLAG "-fopenmp -std=c++0x -ftree-vectorize")
--Put absolute path to the dataset as opposed to relativepath in Main.cpp


Specific changes to make it compaible with ImageNet:
in Objectness/CmFile.cpp line number: added these lines:
415                                     if (line.find (' ') != string::npos)
416                                     {
417                                       int position = line.find (' ');
418                                       strs.push_back(line.substr(0,position));
419                                     }
420                                       else
421                                       strs.push_back(line);


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
The xml annotation file had some inconsistencies for imagenet:
                        ILSVRC2012_val_00029561.xml
                        ILSVRC2012_val_00047711
                        ILSVRC2012_val_00037916
                        ILSVRC2012_val_00027851
                        ILSVRC2012_val_00008272
                           ILSVRC2012_val_00004948
                            ILSVRC2012_val_00000400
                           ILSVRC2012_val_00008009
                          ILSVRC2012_val_00019545
                         ILSVRC2012_val_00032716
                         ILSVRC2012_val_00000922
                         ILSVRC2012_val_00023854
                         ILSVRC2012_val_00035744
  ILSVRC2012_val_00019316
ILSVRC2012_val_00021400
ILSVRC2012_val_00004522
ILSVRC2012_val_00006974
and many more. this cannot be done manually.!
(the coordinates cannot be 0 in matlab!)

%%%%%%%%%%%%%%%
The changes in everything above xml file issues can be ignored




Monday, August 11, 2014

deleting data from a cell in matlab

if A is a cell:
A{m,n}=[] creates an empty element in the (m,n) index
A(m,:)=[] deletes the entire m'th row, A ow has one less row 

Monday, August 4, 2014

Replacing some part of a string or remmoving a part of a string

a=<your_string>
 b=`echo $a | sed 's/<string_you_want_to_replace>//'

(you don't need to put any quotes around <string_you_want_to_replace>)

Sunday, July 20, 2014

some imp commands to be edited later..


 perl -pi -e 's/batchSIFTflow1/batchSIFTflowUsingDecaf/g' myBatchSIFTFLowDecaf*.m
 grep  batchSIFTflowUsingDecaf myBatchSIFTFLowDeca*.m
 perl -pi -e 's/gistL2/DecafL2/g' myBatchSIFTFLowDecaf*.m
 diff myBatchSIFTflow16.m myBatchSIFTFLowDecaf16.m
 sed 's/flow1/flowUsingDecaf/g' myBatchSIFTflow16.m | sed 's/,1,/,20,/g' | sed 's/gistL2/DecafL2/g' > tmp
 diff myBatchSIFTflow16.m tmp
 for i in {1..47}; do sed 's/flow1/flowUsingDecaf/g' myBatchSIFTflow$i.m | sed 's/,1,/,20,/g' | sed 's/gistL2/DecafL2/g' > myBatchSIFTFLowDecaf$i.m; done

Replacing strings in a file

 perl -pi -e 's/pattern/patternToReplace/g' fileName.ext

for i in {2..200}; do
sed 's/xx/'$i'/g' template.m > select-$i.m
done