(argv)
| 28 | |
| 29 | |
| 30 | def main(argv): |
| 31 | pycaffe_dir = os.path.dirname(__file__) |
| 32 | |
| 33 | parser = argparse.ArgumentParser() |
| 34 | # Required arguments: input and output. |
| 35 | parser.add_argument( |
| 36 | "input_file", |
| 37 | help="Input txt/csv filename. If .txt, must be list of filenames.\ |
| 38 | If .csv, must be comma-separated file with header\ |
| 39 | 'filename, xmin, ymin, xmax, ymax'" |
| 40 | ) |
| 41 | parser.add_argument( |
| 42 | "output_file", |
| 43 | help="Output h5/csv filename. Format depends on extension." |
| 44 | ) |
| 45 | # Optional arguments. |
| 46 | parser.add_argument( |
| 47 | "--model_def", |
| 48 | default=os.path.join(pycaffe_dir, |
| 49 | "../models/bvlc_reference_caffenet/deploy.prototxt"), |
| 50 | help="Model definition file." |
| 51 | ) |
| 52 | parser.add_argument( |
| 53 | "--pretrained_model", |
| 54 | default=os.path.join(pycaffe_dir, |
| 55 | "../models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel"), |
| 56 | help="Trained model weights file." |
| 57 | ) |
| 58 | parser.add_argument( |
| 59 | "--crop_mode", |
| 60 | default="selective_search", |
| 61 | choices=CROP_MODES, |
| 62 | help="How to generate windows for detection." |
| 63 | ) |
| 64 | parser.add_argument( |
| 65 | "--gpu", |
| 66 | action='store_true', |
| 67 | help="Switch for gpu computation." |
| 68 | ) |
| 69 | parser.add_argument( |
| 70 | "--mean_file", |
| 71 | default=os.path.join(pycaffe_dir, |
| 72 | 'caffe/imagenet/ilsvrc_2012_mean.npy'), |
| 73 | help="Data set image mean of H x W x K dimensions (numpy array). " + |
| 74 | "Set to '' for no mean subtraction." |
| 75 | ) |
| 76 | parser.add_argument( |
| 77 | "--input_scale", |
| 78 | type=float, |
| 79 | help="Multiply input features by this scale to finish preprocessing." |
| 80 | ) |
| 81 | parser.add_argument( |
| 82 | "--raw_scale", |
| 83 | type=float, |
| 84 | default=255.0, |
| 85 | help="Multiply raw input by this scale before preprocessing." |
| 86 | ) |
| 87 | parser.add_argument( |
no test coverage detected