  if __name__ == "__main__":
      __warning_string = "Important: face-cnn method will cause an error when "
      __warning_string += "this tool is called directly instead of through the "
      __warning_string += "tools.py command script."
      print (__warning_string)
      print ("Images sort tool.\n")
      
      parser = argparse.ArgumentParser()
      subparser = parser.add_subparsers()
      sort = SortProcessor(
              subparser, "sort", "Sort images using various methods.")
  
 
</s> remove         parser.add_argument('-i', '--input',
                            dest="input_dir",
                            default="input_dir",
                            help="Input directory of aligned faces.",
                            required=True)

        parser.add_argument('-o', '--output',
                            dest="output_dir",
                            default="__default",
                            help="Output directory for sorted aligned faces.")

        parser.add_argument('-f', '--final-process',
                            type=str,
                            choices=("folders", "rename"),
                            dest='final_process',
                            default="rename",
                            help="'folders': files are sorted using the "
                                 "-s/--sort-by method, then they are "
                                 "organized into folders using the "
                                 "-g/--group-by grouping method. "
                                 "'rename': files are sorted using the "
                                 "-s/--sort-by then they are renamed."
                                 "Default: rename")

        parser.add_argument('-t', '--ref_threshold',
                            type=float,
                            dest='min_threshold',
                            default=-1.0,
                            help="Float value. "
                                 "Minimum threshold to use for grouping "
                                 "comparison with 'face' and 'hist' methods. "
                                 "The lower the value the more discriminating "
                                 "the grouping is. "
                                 "For face 0.6 should be enough, with 0.5 "
                                 "being very discriminating. "
                                 "For face-cnn 7.2 should be enough, with 4 "
                                 "being very discriminating. "
                                 "For hist 0.3 should be enough, with 0.2 "
                                 "being very discriminating. "
                                 "Be careful setting a value that's too "
                                 "low in a directory with many images, as "
                                 "this could result in a lot of directories "
                                 " being created. "
                                 "Defaults: face 0.6, face-cnn 7.2, hist 0.3")

        parser.add_argument('-b', '--bins',
                            type=int,
                            dest='num_bins',
                            default=5,
                            help="Integer value. "
                                 "Number of folders that will be used to " 
                                 "group by blur. Folder 0 will be the least "
                                 "blurry, while the last folder will be the "
                                 "blurriest. If the number of images doesn't "
                                 "divide evenly into the number of bins, the "
                                 "remaining images get put in the last bin as "
                                 "they will be the blurriest by definition. "
                                 "Default value: 5")

        parser.add_argument('-k', '--keep',
                            action='store_true',
                            dest='keep_original',
                            default=False,
                            help="Keeps the original files in the input "
                                 "directory. Be careful when using this with "
                                 "rename grouping and no specified output "
                                 "directory as this would keep the original "
                                 "and renamed files in the same directory.")

        parser.add_argument('-l', '--log-changes',
                            action='store_true',
                            dest='log_changes',
                            default=False,
                            help="Logs file renaming changes if grouping by "
                                 "renaming, or it logs the file "
                                 "copying/movement if grouping by folders. "
                                 "If no log file is specified with "
                                 "'--log-file', then a 'sort_log.json' file "
                                 "will be created in the input directory.")

        parser.add_argument('-lf', '--log-file',
                            dest='log_file',
                            default='__default',
                            help="Specify a log file to use for saving the "
                                 "renaming or grouping information. "
                                 "Default: sort_log.json")

        parser.add_argument('-s', '--sort-by',
                            type=str,
                            choices=("blur", "face", "face-cnn",
                                     "face-cnn-dissim", "face-dissim", "face-yaw", "hist",
                                     "hist-dissim"),
                            dest='sort_method',
                            default="hist",
                            help="Sort by method. "
                                 "Choose how images are sorted. "
                                 "Default: hist")

        parser.add_argument('-g', '--group-by',
                            type=str,
                            choices=("blur", "face", "face-cnn", "hist"),
                            dest='group_method',
                            default="__default",
                            help="Group by method. "
                                 "When -fp/--final-processing by folders "
                                 "choose the how the images are grouped after "
                                 "sorting. "
                                 "Default: non-dissim version of "
                                 "-s/--sort-by method")
 </s> add         for option in self.argument_list:
            args = option['opts']
            kwargs = {key: option[key] for key in option.keys() if key != 'opts'}
            parser.add_argument(*args, **kwargs) </s> remove         __sort_method = self.arguments.sort_method.lower()
        __group_method = self.arguments.group_method.lower()
        final_process = self.arguments.final_process.lower()

        # Assign the methods that will be used for processing the files
        sort_method = self.set_process_method("sort", __sort_method)
        group_method = self.set_process_method("group", __group_method)
        final_method = self.set_process_method("final_process", final_process)
 </s> add         sort_method = self.args.sort_method.lower()
        group_method = self.args.group_method.lower()
        final_method = self.args.final_process.lower() </s> remove                 score_total += np.sum ( np.absolute ( (fl2 - fl1).flatten() ) )
 </s> add                 score_total += np.sum(np.absolute((fl2 - fl1).flatten())) </s> remove                 score_total += cv2.compareHist(img_list[i][1], img_list[j][1], cv2.HISTCMP_BHATTACHARYYA)
 </s> add                 score_total += cv2.compareHist(img_list[i][1],
                                               img_list[j][1],
                                               cv2.HISTCMP_BHATTACHARYYA)
    print(__warning_string)
    print("Images sort tool.\n")

  if __name__ == "__main__":
      __warning_string = "Important: face-cnn method will cause an error when "
      __warning_string += "this tool is called directly instead of through the "
      __warning_string += "tools.py command script."
    print(__warning_string)
    print("Images sort tool.\n")

    print(__warning_string)
    print("Images sort tool.\n")

    print(__warning_string)
    print("Images sort tool.\n")

      parser = argparse.ArgumentParser()
      subparser = parser.add_subparsers()
      sort = SortProcessor(
              subparser, "sort", "Sort images using various methods.")
  
keep keep keep keep replace replace replace keep keep keep keep keep
 GUI v0.2.1b (#352)

* Code refactor

* Console Added

* Add graphing with matplotlib

* Add GUI preview support

* Improve import handling.

* Add GUI integration for tools.py (Launch tools.py with the gui command)

* Reformat to conform to PEP8.

* Add Tooltips, 

* Make panels user adjustable

* Fix convert.py Sharpen default value 
tools/sort.py