strcmp(var,'<string>')
...this is a log of code snippets and useful tips I wrote/found. Should you find any mistakes or have any useful suggestions, please do not hesitate to write to me.
Friday, August 29, 2014
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')
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
-- 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
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>)
b=`echo $a | sed 's/<string_you_want_to_replace>//
(you don't need to put any quotes around <string_you_want_to_replace>)
Subscribe to:
Posts (Atom)