# =============================================================================== # action: train # =============================================================================== # # calculate the bag of words based on the extracted features # if (args['action'] == 'train') or (args['action'] == 'all'): print "\n=== calculating Visual Bag of Words ===\n" dir = args['dir'] if len(args['featdir']) > 0: dir = args['featdir'] MatchboxLib.calculateBoW(config, dir, ".SIFTComparison.feat.xml.gz", args['precluster'], args['bowsize']) # =============================================================================== # action: bowhist # =============================================================================== # # extract bow histograms # if (args['action'] == 'bowhist') or (args['action'] == 'all'): print "\n=== extract BoW Histograms from directory {0} ===\n".format(args['dir']) dir = args['dir'] if len(args['featdir']) > 0: dir = args['featdir']
# =============================================================================== # action: train # =============================================================================== # # calculate the bag of words based on the extracted features # if (args['action'] == 'train') or (args['action'] == 'all'): print "\n=== calculating Visual Bag of Words ===\n" feature_directory = args['dir'] if len(args['featdir']) > 0: feature_directory = args['featdir'] MatchboxLib.calculateBoW(config, feature_directory, ".SIFTComparison.feat.yml.gz", args['precluster'], args['bowsize'], args['verbose'], args['binary']) # =============================================================================== # action: bowhist # =============================================================================== # # extract bow histograms # if (args['action'] == 'bowhist') or (args['action'] == 'all'): print "\n=== extract BoW Histograms from directory {0} ===\n".format(args['dir']) feature_directory = args['dir'] if len(args['featdir']) > 0: feature_directory = args['featdir']
feat_dir1 = args['dir1'] feat_dir2 = args['dir2'] # extract features # extract features for collection 1 print "\n=== extracting features from directory {0} ===\n".format(args['dir1']) MatchboxLib.extractFeatures(config, args['dir1'], args['sdk'],args['threads'], args['clahe'], feat_dir1, "SIFTComparison") # extract features for collection 2 print "\n=== extracting features from directory {0} ===\n".format(args['dir2']) MatchboxLib.extractFeatures(config, args['dir2'], args['sdk'],args['threads'], args['clahe'], feat_dir2, "SIFTComparison") print "\n=== calculating Bag of Words ===\n".format(args['dir2']) if not os.path.exists("{0}/bow.xml".format(feat_dir1)): MatchboxLib.calculateBoW(config, feat_dir1, args['filter'], args['precluster']) print "\n=== Searching for referencing images in both collections ===\n" print "... extract BoW Histograms of collection2" MatchboxLib.extractBoWHistograms(config,args['dir1'], args['threads'], feat_dir1, "{0}/bow.xml".format(feat_dir1)) MatchboxLib.extractBoWHistograms(config,args['dir2'], args['threads'], feat_dir2, "{0}/bow.xml".format(feat_dir1)) # if (args['action'] == 'duplicates') or (args['action'] == 'all'): # ## print "\n=== Searching for duplicates ===\n" # # # # calculating Bag of Words # print "\n=== Bag of Words Processing ===\n"
args['downsample'], args['verbose'], args['binary'], args['binaryonly'], args['update']) # =============================================================================== # action: train # =============================================================================== # # calculate the bag of words based on the extracted features # if (args['action'] == 'train') or (args['action'] == 'all'): print "\n=== calculating Visual Bag of Words ===\n" MatchboxLib.calculateBoW(config, feature_directory, ".SIFTComparison.feat.xml.gz", args['precluster'], args['bowsize'], args['verbose'], args['binary']) # =============================================================================== # action: bowhist # =============================================================================== # # extract bow histograms # if (args['action'] == 'bowhist') or (args['action'] == 'all'): print "\n=== extract BoW Histograms from directory {0} ===\n".format( collection_directory) MatchboxLib.extractBoWHistograms(config, collection_directory, args['threads'], feature_directory,
# extract features for collection 1 print "\n=== extracting features from directory {0} ===\n".format(args["dir1"]) MatchboxLib.extractFeatures( config, args["dir1"], args["sdk"], args["threads"], args["clahe"], feat_dir1, "SIFTComparison" ) # extract features for collection 2 print "\n=== extracting features from directory {0} ===\n".format(args["dir2"]) MatchboxLib.extractFeatures( config, args["dir2"], args["sdk"], args["threads"], args["clahe"], feat_dir2, "SIFTComparison" ) print "\n=== calculating Bag of Words ===\n".format(args["dir2"]) if not os.path.exists("{0}/bow.xml".format(feat_dir1)): MatchboxLib.calculateBoW(config, feat_dir1, args["filter"], args["precluster"]) print "\n=== Searching for referencing images in both collections ===\n" print "... extract BoW Histograms of collection2" MatchboxLib.extractBoWHistograms( config, args["dir1"], args["threads"], feat_dir1, "{0}/bow.xml".format(feat_dir1) ) MatchboxLib.extractBoWHistograms( config, args["dir2"], args["threads"], feat_dir2, "{0}/bow.xml".format(feat_dir1) ) # if (args['action'] == 'duplicates') or (args['action'] == 'all'): # ## print "\n=== Searching for duplicates ===\n" #