MatchboxLib.clearDirectory(args['dir']) if len(args['featdir']) > 0: MatchboxLib.clearDirectory(args['featdir']) exit() # =============================================================================== # action: extract # =============================================================================== # # extract all relevant features for the duplicate detection task # if (args['action'] == 'extract') or (args['action'] == 'all'): print "\n=== extracting features from directory {0} ===\n".format(args['dir']) MatchboxLib.extractFeatures(config, args['dir'], args['sdk'],args['threads'], args['clahe'], args['featdir'], "SIFTComparison",args['downsample']) # =============================================================================== # 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.clearDirectory(feature_directory, args['verbose']) # =============================================================================== # action: extract # =============================================================================== # # extract all relevant features for the duplicate detection task # if (args['action'] == 'extract') or (args['action'] == 'all'): print "\n=== extracting features from directory {0} ===\n".format( collection_directory) MatchboxLib.extractFeatures(config, collection_directory, args['sdk'], args['threads'], args['clahe'], feature_directory, "SIFTComparison", 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",
# create dirs for collection 2 print "... feature directory: {0}/col2".format(args['featdir']) if not os.path.exists("{0}/col2".format(args['featdir'])): feat_dir2 = "{0}/col2".format(args['featdir']) os.makedirs(feat_dir2) else: 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))
# =============================================================================== # action: extract # =============================================================================== # # extract all relevant features for the duplicate detection task # if (args['action'] == 'extract') or (args['action'] == 'all'): print "\n=== extracting features from directory {0} ===\n".format(collection_directory) MatchboxLib.extractFeatures(config, collection_directory, args['sdk'], args['threads'], args['clahe'], feature_directory, "SIFTComparison", 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"
print "... feature directory: {0}/col2".format(args["featdir"]) if not os.path.exists("{0}/col2".format(args["featdir"])): feat_dir2 = "{0}/col2".format(args["featdir"]) os.makedirs(feat_dir2) else: 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"