Ejemplo n.º 1
0
def sort_camera_trap_images(unsorted_dir):

    json_name = os.path.dirname(unsorted_dir) + ".json"
    snapcat_database_dir = os.path.join(unsorted_dir, json_name)
    snapcat_json = json_database.JSONDatabase(snapcat_database_dir)

    burst.create_bursts(snapcat_json, unsorted_dir)
    segmentation.segment_images(snapcat_json)
    label_images.label_images(snapcat_json)

    user_label_image.user_label_images_burst(snapcat_json)

    generate_report.generate_report(snapcat_json, unsorted_dir)
Ejemplo n.º 2
0
def sort_camera_trap_images(unsorted_dir):

    json_name = os.path.basename(os.path.dirname(unsorted_dir)) + ".json"
    snapcat_database_dir = os.path.join(unsorted_dir, json_name)
    snapcat_json = json_database.JSONDatabase(snapcat_database_dir)

    burst.create_bursts(snapcat_json, unsorted_dir)
    #segmentation.segment_images( snapcat_json )

    #label_images( snapcat_json )

    # TODO make sure this is working well to deliver to Island conservation.
    # make sure the label is saved in the dataset
    user_label_image.user_label_images_burst(snapcat_json)

    generate_report.generate_report(snapcat_json, unsorted_dir)
def main():
  parser = argparse.ArgumentParser()
  parser.add_argument("--image_dir", help="will list all the images within this directory and have user label them", default="")
  parser.add_argument("--json_dir", help="path to the json database for images" )
  parser.add_argument("--gif", help="display all images from burst or not", default="false" )

  args = parser.parse_args()
  

  snapcat_json = json_database.JSONDatabase( args.json_dir )
  image_list = list_all_jpgs ( args.image_dir )

  print( "gif", args.gif.lower() )
  if args.gif.lower() == "true":
    user_label_images_burst( snapcat_json )
  else:
    user_label_images_single( snapcat_json, image_list )
                    print("cat")
                    snapcat_json.update(
                        image, "classifier_label", "cat"
                    )  #TODO - classifier_label will be associated with an area of interest
                elif results[i] >= settings.sort_image[
                        'not_cat_confidence_threshold'] and labels[
                            i] == 'not cats':
                    print("not cat")
                    snapcat_json.update(
                        image, "classifier_label", "not_cat"
                    )  #TODO - classifier_label will be associated with an area of interest
                else:
                    print("unsure")
                    snapcat_json.update(
                        image, "classifier_label", "unsure"
                    )  #TODO - classifier_label will be associated with an area of interest

                break

        snapcat_json.save()


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("--json_dir",
                        help="path to the json database for images")
    args = parser.parse_args()

    snapcat_json = json_database.JSONDatabase(args.json_dir)
    label_images(snapcat_json)