├── README.md ├── data └── rgb_voc │ ├── segvalid.txt │ ├── test.txt │ └── train.txt ├── fcn ├── batch_infer.py ├── infer.py ├── rgb_voc_fcn32s │ ├── deploy.prototxt │ ├── net.py │ ├── solve.py │ ├── solver.prototxt │ ├── train.prototxt │ └── val.prototxt ├── rgb_voc_layers.py ├── tbatch_infer.py └── voc-fcn32s │ └── deploy.prototxt ├── photon └── cat_sprinkler.cpp ├── python ├── count_pascal.py ├── count_pascal_mat.py ├── get_png_palette.py ├── last10.py ├── mask_out.py ├── mat2png.py ├── movie.py ├── png2mat.py ├── resize.py ├── seg_fix.py ├── show_seg.py ├── tcats.py ├── yesno.py ├── zip_dir.py └── zip_neg.py ├── scripts ├── cats.sh ├── dclean.sh ├── spoff ├── spon ├── sprinkle.sh ├── sprinkle_off.sh └── tcats.sh └── src ├── Makefile ├── bright.cpp ├── cropper.cpp ├── example.cpp ├── extract_fg.cpp └── snapshots.cpp /README.md: -------------------------------------------------------------------------------- 1 | # chasing-cats 2 | Jetson cat chasing: Turn on the lawn sprinkler when a neural net sees a cat. 3 | 4 | A collection of utilities useful for working with segmented images 5 | and the fcn variant of Caffe. See 6 | my page 7 | for a description of the system. 8 | 9 | photon: 10 | cat_sprinkler.cpp Firmware for the photon 11 | 12 | python: 13 | count_pascal_mat.py Counts classified pixels in a Pascal Context .mat file 14 | count_pascal.py Coutns classified pixels in a Pascal Context .png file 15 | get_png_palette.py Gets the pallete from a .png file 16 | last10.py Show the last 10 shots from the camera at 1/2 res 17 | mask_out.py Masks out and colorizes the classified pixels in an image 18 | mat2png.py Convert a Pascal Context .mat file to .png 19 | movie.py Spin through a bunch of images on the command line 20 | png2mat.py Convert a Pascal Context .png file to .mat 21 | resize.py Resize an image 22 | seg_fix.py Demo for how to change the segmentation in a file 23 | show_seg.py Overlays displays a base image with the semented pixels 24 | yesno.py Sort a bunch of images into "yes" and "no" buckets 25 | zip_dir.py Zip two directories together 26 | zip_neg.py Zip a directory with a single file 27 | 28 | scripts: 29 | cats.sh Simple script to run fcn segmentations on files coming in from FTP 30 | dclean.sh Monitor an FTP directory 31 | tcats.sh The one I use 32 | spon Disable the sprinkler 33 | spoff Enable the sprinkler 34 | sprinkle.sh Start the sprinkler 35 | sprinkle_off.sh Stop the sprinkler 36 | 37 | src: 38 | bright.cpp Brighten images 39 | cropper.cpp Crop images to 227 x 227 pixels 40 | example.cpp Simple GPU example used to debug opencv builds 41 | extract_fg.cpp Foreground extraction utility 42 | snapshots.cpp Convert a movie to single frames 43 | 44 | fcn: Modified files from the Shellhammer github 45 | infer.py Saves a file in addition to processing a file 46 | batch_infer.py Processes a bunch of files from the command line 47 | tbatch_infer.py The one I use to process inbound cat images 48 | voc-fcn32s: 49 | deploy.prototxt A deployment version of trainval.prototxt 50 | -------------------------------------------------------------------------------- /data/rgb_voc/segvalid.txt: -------------------------------------------------------------------------------- 1 | 0161.jpg 2 | 0055.jpg 3 | MDAlarm_20160618-172135.jpg 4 | 0089.jpg 5 | MDAlarm_20160618-230930.jpg 6 | 0174.jpg 7 | 0165.jpg 8 | 0251.jpg 9 | 0204.jpg 10 | 0125.jpg 11 | 0224.jpg 12 | 0039.jpg 13 | 0019.jpg 14 | 0263.jpg 15 | 0166.jpg 16 | 0064.jpg 17 | 0177.jpg 18 | 0173.jpg 19 | 0247.jpg 20 | 0123.jpg 21 | 0018.jpg 22 | 0220.jpg 23 | 0060.jpg 24 | 0154.jpg 25 | MDAlarm_20160622-083355.jpg 26 | 0208.jpg 27 | 0148.jpg 28 | 0050.jpg 29 | 0057.jpg 30 | 08.jpg 31 | 0083.jpg 32 | 0061.jpg 33 | 0081.jpg 34 | 0192.jpg 35 | 0088.jpg 36 | 0278.jpg 37 | 0011.jpg 38 | 0197.jpg 39 | MDAlarm_20160618-023514.jpg 40 | 0024.jpg 41 | 0192.jpg 42 | 0132.jpg 43 | 0043.jpg 44 | 0291.jpg 45 | 0011.jpg 46 | 0158.jpg 47 | 0016.jpg 48 | 0044.jpg 49 | 0141.jpg 50 | 0233.jpg 51 | 0063.jpg 52 | 0225.jpg 53 | 0006.jpg 54 | 0118.jpg 55 | 0023.jpg 56 | 0249.jpg 57 | 0013.jpg 58 | -------------------------------------------------------------------------------- /data/rgb_voc/test.txt: -------------------------------------------------------------------------------- 1 | /caffe/drive_rc/images/yardp.fg/0161.jpg /caffe/drive_rc/images/yardp.seg/0161.png 2 | /caffe/drive_rc/images/yard.fg/0055.jpg /caffe/drive_rc/images/yard.seg/0055.png 3 | /caffe/drive_rc/images/negs/MDAlarm_20160618-172135.jpg /caffe/drive_rc/images/empty_seg.png 4 | /caffe/drive_rc/images/yard.fg/0089.jpg /caffe/drive_rc/images/yard.seg/0089.png 5 | /caffe/drive_rc/images/negs/MDAlarm_20160618-230930.jpg /caffe/drive_rc/images/empty_seg.png 6 | /caffe/drive_rc/images/yardp.fg/0174.jpg /caffe/drive_rc/images/yardp.seg/0174.png 7 | /caffe/drive_rc/images/yard.fg/0165.jpg /caffe/drive_rc/images/yard.seg/0165.png 8 | /caffe/drive_rc/images/yard.fg/0251.jpg /caffe/drive_rc/images/yard.seg/0251.png 9 | /caffe/drive_rc/images/yard.fg/0204.jpg /caffe/drive_rc/images/yard.seg/0204.png 10 | /caffe/drive_rc/images/yardp.fg/0125.jpg /caffe/drive_rc/images/yardp.seg/0125.png 11 | /caffe/drive_rc/images/yard.fg/0224.jpg /caffe/drive_rc/images/yard.seg/0224.png 12 | /caffe/drive_rc/images/yard.fg/0039.jpg /caffe/drive_rc/images/yard.seg/0039.png 13 | /caffe/drive_rc/images/yardp.fg/0019.jpg /caffe/drive_rc/images/yardp.seg/0019.png 14 | /caffe/drive_rc/images/yard.fg/0263.jpg /caffe/drive_rc/images/yard.seg/0263.png 15 | /caffe/drive_rc/images/yardp.fg/0166.jpg /caffe/drive_rc/images/yardp.seg/0166.png 16 | /caffe/drive_rc/images/yardp.fg/0064.jpg /caffe/drive_rc/images/yardp.seg/0064.png 17 | /caffe/drive_rc/images/yard.fg/0177.jpg /caffe/drive_rc/images/yard.seg/0177.png 18 | /caffe/drive_rc/images/yard.fg/0173.jpg /caffe/drive_rc/images/yard.seg/0173.png 19 | /caffe/drive_rc/images/yard.fg/0247.jpg /caffe/drive_rc/images/yard.seg/0247.png 20 | /caffe/drive_rc/images/yard.fg/0123.jpg /caffe/drive_rc/images/yard.seg/0123.png 21 | /caffe/drive_rc/images/yardp.fg/0018.jpg /caffe/drive_rc/images/yardp.seg/0018.png 22 | /caffe/drive_rc/images/yard.fg/0220.jpg /caffe/drive_rc/images/yard.seg/0220.png 23 | /caffe/drive_rc/images/yard.fg/0060.jpg /caffe/drive_rc/images/yard.seg/0060.png 24 | /caffe/drive_rc/images/yardp.fg/0154.jpg /caffe/drive_rc/images/yardp.seg/0154.png 25 | /caffe/drive_rc/images/negs/MDAlarm_20160622-083355.jpg /caffe/drive_rc/images/empty_seg.png 26 | /caffe/drive_rc/images/yard.fg/0208.jpg /caffe/drive_rc/images/yard.seg/0208.png 27 | /caffe/drive_rc/images/yardp.fg/0148.jpg /caffe/drive_rc/images/yardp.seg/0148.png 28 | /caffe/drive_rc/images/yardp.fg/0050.jpg /caffe/drive_rc/images/yardp.seg/0050.png 29 | /caffe/drive_rc/images/yardp.fg/0057.jpg /caffe/drive_rc/images/yardp.seg/0057.png 30 | /caffe/drive_rc/images/yardp.fg/0108.jpg /caffe/drive_rc/images/yardp.seg/0108.png 31 | /caffe/drive_rc/images/yard.fg/0083.jpg /caffe/drive_rc/images/yard.seg/0083.png 32 | /caffe/drive_rc/images/yard.fg/0061.jpg /caffe/drive_rc/images/yard.seg/0061.png 33 | /caffe/drive_rc/images/yardp.fg/0081.jpg /caffe/drive_rc/images/yardp.seg/0081.png 34 | /caffe/drive_rc/images/yardp.fg/0192.jpg /caffe/drive_rc/images/yardp.seg/0192.png 35 | /caffe/drive_rc/images/yard.fg/0088.jpg /caffe/drive_rc/images/yard.seg/0088.png 36 | /caffe/drive_rc/images/yard.fg/0278.jpg /caffe/drive_rc/images/yard.seg/0278.png 37 | /caffe/drive_rc/images/yard.fg/0011.jpg /caffe/drive_rc/images/yard.seg/0011.png 38 | /caffe/drive_rc/images/yardp.fg/0197.jpg /caffe/drive_rc/images/yardp.seg/0197.png 39 | /caffe/drive_rc/images/negs/MDAlarm_20160618-023514.jpg /caffe/drive_rc/images/empty_seg.png 40 | /caffe/drive_rc/images/yard.fg/0024.jpg /caffe/drive_rc/images/yard.seg/0024.png 41 | /caffe/drive_rc/images/yard.fg/0192.jpg /caffe/drive_rc/images/yard.seg/0192.png 42 | /caffe/drive_rc/images/yard.fg/0132.jpg /caffe/drive_rc/images/yard.seg/0132.png 43 | /caffe/drive_rc/images/yardp.fg/0043.jpg /caffe/drive_rc/images/yardp.seg/0043.png 44 | /caffe/drive_rc/images/yard.fg/0291.jpg /caffe/drive_rc/images/yard.seg/0291.png 45 | /caffe/drive_rc/images/yardp.fg/0011.jpg /caffe/drive_rc/images/yardp.seg/0011.png 46 | /caffe/drive_rc/images/yardp.fg/0158.jpg /caffe/drive_rc/images/yardp.seg/0158.png 47 | /caffe/drive_rc/images/yardp.fg/0016.jpg /caffe/drive_rc/images/yardp.seg/0016.png 48 | /caffe/drive_rc/images/yardp.fg/0044.jpg /caffe/drive_rc/images/yardp.seg/0044.png 49 | /caffe/drive_rc/images/yard.fg/0141.jpg /caffe/drive_rc/images/yard.seg/0141.png 50 | /caffe/drive_rc/images/yard.fg/0233.jpg /caffe/drive_rc/images/yard.seg/0233.png 51 | /caffe/drive_rc/images/yard.fg/0063.jpg /caffe/drive_rc/images/yard.seg/0063.png 52 | /caffe/drive_rc/images/yard.fg/0225.jpg /caffe/drive_rc/images/yard.seg/0225.png 53 | /caffe/drive_rc/images/yard.fg/0006.jpg /caffe/drive_rc/images/yard.seg/0006.png 54 | /caffe/drive_rc/images/yardp.fg/0118.jpg /caffe/drive_rc/images/yardp.seg/0118.png 55 | /caffe/drive_rc/images/yardp.fg/0023.jpg /caffe/drive_rc/images/yardp.seg/0023.png 56 | /caffe/drive_rc/images/yard.fg/0249.jpg /caffe/drive_rc/images/yard.seg/0249.png 57 | /caffe/drive_rc/images/yardp.fg/0013.jpg /caffe/drive_rc/images/yardp.seg/0013.png 58 | -------------------------------------------------------------------------------- /data/rgb_voc/train.txt: -------------------------------------------------------------------------------- 1 | /caffe/drive_rc/images/negs/MDAlarm_20160620-083644.jpg /caffe/drive_rc/images/empty_seg.png 2 | /caffe/drive_rc/images/yardp.fg/0128.jpg /caffe/drive_rc/images/yardp.seg/0128.png 3 | /caffe/drive_rc/images/negs/MDAlarm_20160619-174354.jpg /caffe/drive_rc/images/empty_seg.png 4 | /caffe/drive_rc/images/yardp.fg/0025.jpg /caffe/drive_rc/images/yardp.seg/0025.png 5 | /caffe/drive_rc/images/yardp.fg/0074.jpg /caffe/drive_rc/images/yardp.seg/0074.png 6 | /caffe/drive_rc/images/yard.fg/0048.jpg /caffe/drive_rc/images/yard.seg/0048.png 7 | /caffe/drive_rc/images/yard.fg/0226.jpg /caffe/drive_rc/images/yard.seg/0226.png 8 | /caffe/drive_rc/images/yard.fg/0082.jpg /caffe/drive_rc/images/yard.seg/0082.png 9 | /caffe/drive_rc/images/yardp.fg/0157.jpg /caffe/drive_rc/images/yardp.seg/0157.png 10 | /caffe/drive_rc/images/yardp.fg/0131.jpg /caffe/drive_rc/images/yardp.seg/0131.png 11 | /caffe/drive_rc/images/yard.fg/0116.jpg /caffe/drive_rc/images/yard.seg/0116.png 12 | /caffe/drive_rc/images/yard.fg/0231.jpg /caffe/drive_rc/images/yard.seg/0231.png 13 | /caffe/drive_rc/images/negs/MDAlarm_20160622-083351.jpg /caffe/drive_rc/images/empty_seg.png 14 | /caffe/drive_rc/images/yard.fg/0300.jpg /caffe/drive_rc/images/yard.seg/0300.png 15 | /caffe/drive_rc/images/yard.fg/0136.jpg /caffe/drive_rc/images/yard.seg/0136.png 16 | /caffe/drive_rc/images/yardp.fg/0033.jpg /caffe/drive_rc/images/yardp.seg/0033.png 17 | /caffe/drive_rc/images/yardp.fg/0127.jpg /caffe/drive_rc/images/yardp.seg/0127.png 18 | /caffe/drive_rc/images/yard.fg/0215.jpg /caffe/drive_rc/images/yard.seg/0215.png 19 | /caffe/drive_rc/images/yard.fg/0161.jpg /caffe/drive_rc/images/yard.seg/0161.png 20 | /caffe/drive_rc/images/yard.fg/0078.jpg /caffe/drive_rc/images/yard.seg/0078.png 21 | /caffe/drive_rc/images/yard.fg/0205.jpg /caffe/drive_rc/images/yard.seg/0205.png 22 | /caffe/drive_rc/images/negs/MDAlarm_20160617-181556.jpg /caffe/drive_rc/images/empty_seg.png 23 | /caffe/drive_rc/images/yardp.fg/0071.jpg /caffe/drive_rc/images/yardp.seg/0071.png 24 | /caffe/drive_rc/images/negs/MDAlarm_20160621-042603.jpg /caffe/drive_rc/images/empty_seg.png 25 | /caffe/drive_rc/images/yard.fg/0073.jpg /caffe/drive_rc/images/yard.seg/0073.png 26 | /caffe/drive_rc/images/yard.fg/0199.jpg /caffe/drive_rc/images/yard.seg/0199.png 27 | /caffe/drive_rc/images/yard.fg/0015.jpg /caffe/drive_rc/images/yard.seg/0015.png 28 | /caffe/drive_rc/images/yardp.fg/0077.jpg /caffe/drive_rc/images/yardp.seg/0077.png 29 | /caffe/drive_rc/images/negs/MDAlarm_20160622-072952.jpg /caffe/drive_rc/images/empty_seg.png 30 | /caffe/drive_rc/images/yard.fg/0146.jpg /caffe/drive_rc/images/yard.seg/0146.png 31 | /caffe/drive_rc/images/negs/MDAlarm_20160621-174506.jpg /caffe/drive_rc/images/empty_seg.png 32 | /caffe/drive_rc/images/negs/MDAlarm_20160619-100819.jpg /caffe/drive_rc/images/empty_seg.png 33 | /caffe/drive_rc/images/negs/MDAlarm_20160622-083608.jpg /caffe/drive_rc/images/empty_seg.png 34 | /caffe/drive_rc/images/negs/MDAlarm_20160620-200256.jpg /caffe/drive_rc/images/empty_seg.png 35 | /caffe/drive_rc/images/yard.fg/0209.jpg /caffe/drive_rc/images/yard.seg/0209.png 36 | /caffe/drive_rc/images/negs/MDAlarm_20160620-173653.jpg /caffe/drive_rc/images/empty_seg.png 37 | /caffe/drive_rc/images/yard.fg/0287.jpg /caffe/drive_rc/images/yard.seg/0287.png 38 | /caffe/drive_rc/images/yard.fg/0223.jpg /caffe/drive_rc/images/yard.seg/0223.png 39 | /caffe/drive_rc/images/yardp.fg/0008.jpg /caffe/drive_rc/images/yardp.seg/0008.png 40 | /caffe/drive_rc/images/yardp.fg/0115.jpg /caffe/drive_rc/images/yardp.seg/0115.png 41 | /caffe/drive_rc/images/yardp.fg/0004.jpg /caffe/drive_rc/images/yardp.seg/0004.png 42 | /caffe/drive_rc/images/yard.fg/0190.jpg /caffe/drive_rc/images/yard.seg/0190.png 43 | /caffe/drive_rc/images/yardp.fg/0035.jpg /caffe/drive_rc/images/yardp.seg/0035.png 44 | /caffe/drive_rc/images/yard.fg/0294.jpg /caffe/drive_rc/images/yard.seg/0294.png 45 | /caffe/drive_rc/images/yardp.fg/0139.jpg /caffe/drive_rc/images/yardp.seg/0139.png 46 | /caffe/drive_rc/images/negs/MDAlarm_20160620-083645.jpg /caffe/drive_rc/images/empty_seg.png 47 | /caffe/drive_rc/images/yardp.fg/0178.jpg /caffe/drive_rc/images/yardp.seg/0178.png 48 | /caffe/drive_rc/images/yardp.fg/0015.jpg /caffe/drive_rc/images/yardp.seg/0015.png 49 | /caffe/drive_rc/images/yard.fg/0151.jpg /caffe/drive_rc/images/yard.seg/0151.png 50 | /caffe/drive_rc/images/yardp.fg/0170.jpg /caffe/drive_rc/images/yardp.seg/0170.png 51 | /caffe/drive_rc/images/yard.fg/0256.jpg /caffe/drive_rc/images/yard.seg/0256.png 52 | /caffe/drive_rc/images/yard.fg/0038.jpg /caffe/drive_rc/images/yard.seg/0038.png 53 | /caffe/drive_rc/images/negs/MDAlarm_20160622-083352.jpg /caffe/drive_rc/images/empty_seg.png 54 | /caffe/drive_rc/images/yardp.fg/0147.jpg /caffe/drive_rc/images/yardp.seg/0147.png 55 | /caffe/drive_rc/images/yard.fg/0092.jpg /caffe/drive_rc/images/yard.seg/0092.png 56 | /caffe/drive_rc/images/yardp.fg/0068.jpg /caffe/drive_rc/images/yardp.seg/0068.png 57 | /caffe/drive_rc/images/yard.fg/0080.jpg /caffe/drive_rc/images/yard.seg/0080.png 58 | /caffe/drive_rc/images/yard.fg/0072.jpg /caffe/drive_rc/images/yard.seg/0072.png 59 | /caffe/drive_rc/images/yard.fg/0064.jpg /caffe/drive_rc/images/yard.seg/0064.png 60 | /caffe/drive_rc/images/yard.fg/0268.jpg /caffe/drive_rc/images/yard.seg/0268.png 61 | /caffe/drive_rc/images/yard.fg/0133.jpg /caffe/drive_rc/images/yard.seg/0133.png 62 | /caffe/drive_rc/images/yardp.fg/0059.jpg /caffe/drive_rc/images/yardp.seg/0059.png 63 | /caffe/drive_rc/images/yardp.fg/0182.jpg /caffe/drive_rc/images/yardp.seg/0182.png 64 | /caffe/drive_rc/images/yard.fg/0009.jpg /caffe/drive_rc/images/yard.seg/0009.png 65 | /caffe/drive_rc/images/yard.fg/0097.jpg /caffe/drive_rc/images/yard.seg/0097.png 66 | /caffe/drive_rc/images/yardp.fg/0103.jpg /caffe/drive_rc/images/yardp.seg/0103.png 67 | /caffe/drive_rc/images/yard.fg/0264.jpg /caffe/drive_rc/images/yard.seg/0264.png 68 | /caffe/drive_rc/images/yard.fg/0016.jpg /caffe/drive_rc/images/yard.seg/0016.png 69 | /caffe/drive_rc/images/negs/MDAlarm_20160619-100829.jpg /caffe/drive_rc/images/empty_seg.png 70 | /caffe/drive_rc/images/yard.fg/0270.jpg /caffe/drive_rc/images/yard.seg/0270.png 71 | /caffe/drive_rc/images/yardp.fg/0152.jpg /caffe/drive_rc/images/yardp.seg/0152.png 72 | /caffe/drive_rc/images/yardp.fg/0045.jpg /caffe/drive_rc/images/yardp.seg/0045.png 73 | /caffe/drive_rc/images/yardp.fg/0101.jpg /caffe/drive_rc/images/yardp.seg/0101.png 74 | /caffe/drive_rc/images/negs/MDAlarm_20160619-013851.jpg /caffe/drive_rc/images/empty_seg.png 75 | /caffe/drive_rc/images/yard.fg/0158.jpg /caffe/drive_rc/images/yard.seg/0158.png 76 | /caffe/drive_rc/images/negs/MDAlarm_20160622-175659.jpg /caffe/drive_rc/images/empty_seg.png 77 | /caffe/drive_rc/images/negs/MDAlarm_20160619-174357.jpg /caffe/drive_rc/images/empty_seg.png 78 | /caffe/drive_rc/images/yard.fg/0025.jpg /caffe/drive_rc/images/yard.seg/0025.png 79 | /caffe/drive_rc/images/yard.fg/0102.jpg /caffe/drive_rc/images/yard.seg/0102.png 80 | /caffe/drive_rc/images/yard.fg/0091.jpg /caffe/drive_rc/images/yard.seg/0091.png 81 | /caffe/drive_rc/images/yard.fg/0239.jpg /caffe/drive_rc/images/yard.seg/0239.png 82 | /caffe/drive_rc/images/yard.fg/0145.jpg /caffe/drive_rc/images/yard.seg/0145.png 83 | /caffe/drive_rc/images/yardp.fg/0149.jpg /caffe/drive_rc/images/yardp.seg/0149.png 84 | /caffe/drive_rc/images/yard.fg/0280.jpg /caffe/drive_rc/images/yard.seg/0280.png 85 | /caffe/drive_rc/images/negs/MDAlarm_20160620-082908.jpg /caffe/drive_rc/images/empty_seg.png 86 | /caffe/drive_rc/images/yardp.fg/0190.jpg /caffe/drive_rc/images/yardp.seg/0190.png 87 | /caffe/drive_rc/images/yard.fg/0281.jpg /caffe/drive_rc/images/yard.seg/0281.png 88 | /caffe/drive_rc/images/yard.fg/0273.jpg /caffe/drive_rc/images/yard.seg/0273.png 89 | /caffe/drive_rc/images/negs/MDAlarm_20160616-123947.jpg /caffe/drive_rc/images/empty_seg.png 90 | /caffe/drive_rc/images/yardp.fg/0030.jpg /caffe/drive_rc/images/yardp.seg/0030.png 91 | /caffe/drive_rc/images/yard.fg/0013.jpg /caffe/drive_rc/images/yard.seg/0013.png 92 | /caffe/drive_rc/images/yardp.fg/0046.jpg /caffe/drive_rc/images/yardp.seg/0046.png 93 | /caffe/drive_rc/images/negs/MDAlarm_20160622-175351.jpg /caffe/drive_rc/images/empty_seg.png 94 | /caffe/drive_rc/images/yard.fg/0090.jpg /caffe/drive_rc/images/yard.seg/0090.png 95 | /caffe/drive_rc/images/yard.fg/0185.jpg /caffe/drive_rc/images/yard.seg/0185.png 96 | /caffe/drive_rc/images/yard.fg/0095.jpg /caffe/drive_rc/images/yard.seg/0095.png 97 | /caffe/drive_rc/images/yardp.fg/0094.jpg /caffe/drive_rc/images/yardp.seg/0094.png 98 | /caffe/drive_rc/images/yard.fg/0238.jpg /caffe/drive_rc/images/yard.seg/0238.png 99 | /caffe/drive_rc/images/yardp.fg/0136.jpg /caffe/drive_rc/images/yardp.seg/0136.png 100 | /caffe/drive_rc/images/yard.fg/0217.jpg /caffe/drive_rc/images/yard.seg/0217.png 101 | /caffe/drive_rc/images/negs/MDAlarm_20160620-164110.jpg /caffe/drive_rc/images/empty_seg.png 102 | /caffe/drive_rc/images/yardp.fg/0092.jpg /caffe/drive_rc/images/yardp.seg/0092.png 103 | /caffe/drive_rc/images/yard.fg/0227.jpg /caffe/drive_rc/images/yard.seg/0227.png 104 | /caffe/drive_rc/images/yardp.fg/0005.jpg /caffe/drive_rc/images/yardp.seg/0005.png 105 | /caffe/drive_rc/images/yard.fg/0147.jpg /caffe/drive_rc/images/yard.seg/0147.png 106 | /caffe/drive_rc/images/yard.fg/0005.jpg /caffe/drive_rc/images/yard.seg/0005.png 107 | /caffe/drive_rc/images/yard.fg/0079.jpg /caffe/drive_rc/images/yard.seg/0079.png 108 | /caffe/drive_rc/images/negs/MDAlarm_20160620-234228.jpg /caffe/drive_rc/images/empty_seg.png 109 | /caffe/drive_rc/images/yardp.fg/0020.jpg /caffe/drive_rc/images/yardp.seg/0020.png 110 | /caffe/drive_rc/images/yard.fg/0232.jpg /caffe/drive_rc/images/yard.seg/0232.png 111 | /caffe/drive_rc/images/yard.fg/0171.jpg /caffe/drive_rc/images/yard.seg/0171.png 112 | /caffe/drive_rc/images/yardp.fg/0099.jpg /caffe/drive_rc/images/yardp.seg/0099.png 113 | /caffe/drive_rc/images/yard.fg/0034.jpg /caffe/drive_rc/images/yard.seg/0034.png 114 | /caffe/drive_rc/images/yardp.fg/0124.jpg /caffe/drive_rc/images/yardp.seg/0124.png 115 | /caffe/drive_rc/images/negs/MDAlarm_20160620-113622.jpg /caffe/drive_rc/images/empty_seg.png 116 | /caffe/drive_rc/images/yard.fg/0112.jpg /caffe/drive_rc/images/yard.seg/0112.png 117 | /caffe/drive_rc/images/yardp.fg/0164.jpg /caffe/drive_rc/images/yardp.seg/0164.png 118 | /caffe/drive_rc/images/negs/MDAlarm_20160620-083721.jpg /caffe/drive_rc/images/empty_seg.png 119 | /caffe/drive_rc/images/negs/MDAlarm_20160618-174345.jpg /caffe/drive_rc/images/empty_seg.png 120 | /caffe/drive_rc/images/yard.fg/0057.jpg /caffe/drive_rc/images/yard.seg/0057.png 121 | /caffe/drive_rc/images/yard.fg/0203.jpg /caffe/drive_rc/images/yard.seg/0203.png 122 | /caffe/drive_rc/images/yard.fg/0121.jpg /caffe/drive_rc/images/yard.seg/0121.png 123 | /caffe/drive_rc/images/yardp.fg/0162.jpg /caffe/drive_rc/images/yardp.seg/0162.png 124 | /caffe/drive_rc/images/yardp.fg/0171.jpg /caffe/drive_rc/images/yardp.seg/0171.png 125 | /caffe/drive_rc/images/yard.fg/0292.jpg /caffe/drive_rc/images/yard.seg/0292.png 126 | /caffe/drive_rc/images/yard.fg/0214.jpg /caffe/drive_rc/images/yard.seg/0214.png 127 | /caffe/drive_rc/images/yardp.fg/0080.jpg /caffe/drive_rc/images/yardp.seg/0080.png 128 | /caffe/drive_rc/images/yardp.fg/0067.jpg /caffe/drive_rc/images/yardp.seg/0067.png 129 | /caffe/drive_rc/images/yard.fg/0188.jpg /caffe/drive_rc/images/yard.seg/0188.png 130 | /caffe/drive_rc/images/yard.fg/0042.jpg /caffe/drive_rc/images/yard.seg/0042.png 131 | /caffe/drive_rc/images/yard.fg/0275.jpg /caffe/drive_rc/images/yard.seg/0275.png 132 | /caffe/drive_rc/images/yard.fg/0288.jpg /caffe/drive_rc/images/yard.seg/0288.png 133 | /caffe/drive_rc/images/yard.fg/0108.jpg /caffe/drive_rc/images/yard.seg/0108.png 134 | /caffe/drive_rc/images/yard.fg/0125.jpg /caffe/drive_rc/images/yard.seg/0125.png 135 | /caffe/drive_rc/images/yard.fg/0234.jpg /caffe/drive_rc/images/yard.seg/0234.png 136 | /caffe/drive_rc/images/yardp.fg/0007.jpg /caffe/drive_rc/images/yardp.seg/0007.png 137 | /caffe/drive_rc/images/yardp.fg/0177.jpg /caffe/drive_rc/images/yardp.seg/0177.png 138 | /caffe/drive_rc/images/yard.fg/0286.jpg /caffe/drive_rc/images/yard.seg/0286.png 139 | /caffe/drive_rc/images/yard.fg/0041.jpg /caffe/drive_rc/images/yard.seg/0041.png 140 | /caffe/drive_rc/images/yard.fg/0044.jpg /caffe/drive_rc/images/yard.seg/0044.png 141 | /caffe/drive_rc/images/yardp.fg/0006.jpg /caffe/drive_rc/images/yardp.seg/0006.png 142 | /caffe/drive_rc/images/yardp.fg/0052.jpg /caffe/drive_rc/images/yardp.seg/0052.png 143 | /caffe/drive_rc/images/yard.fg/0235.jpg /caffe/drive_rc/images/yard.seg/0235.png 144 | /caffe/drive_rc/images/yard.fg/0094.jpg /caffe/drive_rc/images/yard.seg/0094.png 145 | /caffe/drive_rc/images/negs/MDAlarm_20160620-200258.jpg /caffe/drive_rc/images/empty_seg.png 146 | /caffe/drive_rc/images/yard.fg/0187.jpg /caffe/drive_rc/images/yard.seg/0187.png 147 | /caffe/drive_rc/images/yardp.fg/0181.jpg /caffe/drive_rc/images/yardp.seg/0181.png 148 | /caffe/drive_rc/images/yardp.fg/0144.jpg /caffe/drive_rc/images/yardp.seg/0144.png 149 | /caffe/drive_rc/images/yard.fg/0113.jpg /caffe/drive_rc/images/yard.seg/0113.png 150 | /caffe/drive_rc/images/yard.fg/0296.jpg /caffe/drive_rc/images/yard.seg/0296.png 151 | /caffe/drive_rc/images/yardp.fg/0100.jpg /caffe/drive_rc/images/yardp.seg/0100.png 152 | /caffe/drive_rc/images/yardp.fg/0168.jpg /caffe/drive_rc/images/yardp.seg/0168.png 153 | /caffe/drive_rc/images/yard.fg/0277.jpg /caffe/drive_rc/images/yard.seg/0277.png 154 | /caffe/drive_rc/images/yardp.fg/0135.jpg /caffe/drive_rc/images/yardp.seg/0135.png 155 | /caffe/drive_rc/images/yard.fg/0212.jpg /caffe/drive_rc/images/yard.seg/0212.png 156 | /caffe/drive_rc/images/yardp.fg/0193.jpg /caffe/drive_rc/images/yardp.seg/0193.png 157 | /caffe/drive_rc/images/yardp.fg/0062.jpg /caffe/drive_rc/images/yardp.seg/0062.png 158 | /caffe/drive_rc/images/yard.fg/0191.jpg /caffe/drive_rc/images/yard.seg/0191.png 159 | /caffe/drive_rc/images/yardp.fg/0086.jpg /caffe/drive_rc/images/yardp.seg/0086.png 160 | /caffe/drive_rc/images/yard.fg/0267.jpg /caffe/drive_rc/images/yard.seg/0267.png 161 | /caffe/drive_rc/images/yardp.fg/0187.jpg /caffe/drive_rc/images/yardp.seg/0187.png 162 | /caffe/drive_rc/images/yard.fg/0050.jpg /caffe/drive_rc/images/yard.seg/0050.png 163 | /caffe/drive_rc/images/negs/MDAlarm_20160621-174505.jpg /caffe/drive_rc/images/empty_seg.png 164 | /caffe/drive_rc/images/yard.fg/0062.jpg /caffe/drive_rc/images/yard.seg/0062.png 165 | /caffe/drive_rc/images/negs/MDAlarm_20160619-173425.jpg /caffe/drive_rc/images/empty_seg.png 166 | /caffe/drive_rc/images/yardp.fg/0001.jpg /caffe/drive_rc/images/yardp.seg/0001.png 167 | /caffe/drive_rc/images/yard.fg/0070.jpg /caffe/drive_rc/images/yard.seg/0070.png 168 | /caffe/drive_rc/images/yard.fg/0216.jpg /caffe/drive_rc/images/yard.seg/0216.png 169 | /caffe/drive_rc/images/yard.fg/0156.jpg /caffe/drive_rc/images/yard.seg/0156.png 170 | /caffe/drive_rc/images/yardp.fg/0195.jpg /caffe/drive_rc/images/yardp.seg/0195.png 171 | /caffe/drive_rc/images/yardp.fg/0176.jpg /caffe/drive_rc/images/yardp.seg/0176.png 172 | /caffe/drive_rc/images/yard.fg/0252.jpg /caffe/drive_rc/images/yard.seg/0252.png 173 | /caffe/drive_rc/images/yard.fg/0271.jpg /caffe/drive_rc/images/yard.seg/0271.png 174 | /caffe/drive_rc/images/yardp.fg/0194.jpg /caffe/drive_rc/images/yardp.seg/0194.png 175 | /caffe/drive_rc/images/yard.fg/0202.jpg /caffe/drive_rc/images/yard.seg/0202.png 176 | /caffe/drive_rc/images/yard.fg/0206.jpg /caffe/drive_rc/images/yard.seg/0206.png 177 | /caffe/drive_rc/images/yardp.fg/0058.jpg /caffe/drive_rc/images/yardp.seg/0058.png 178 | /caffe/drive_rc/images/yardp.fg/0012.jpg /caffe/drive_rc/images/yardp.seg/0012.png 179 | /caffe/drive_rc/images/yardp.fg/0114.jpg /caffe/drive_rc/images/yardp.seg/0114.png 180 | /caffe/drive_rc/images/yard.fg/0290.jpg /caffe/drive_rc/images/yard.seg/0290.png 181 | /caffe/drive_rc/images/negs/MDAlarm_20160620-200259.jpg /caffe/drive_rc/images/empty_seg.png 182 | /caffe/drive_rc/images/yard.fg/0068.jpg /caffe/drive_rc/images/yard.seg/0068.png 183 | /caffe/drive_rc/images/yard.fg/0046.jpg /caffe/drive_rc/images/yard.seg/0046.png 184 | /caffe/drive_rc/images/yard.fg/0183.jpg /caffe/drive_rc/images/yard.seg/0183.png 185 | /caffe/drive_rc/images/yardp.fg/0036.jpg /caffe/drive_rc/images/yardp.seg/0036.png 186 | /caffe/drive_rc/images/yard.fg/0093.jpg /caffe/drive_rc/images/yard.seg/0093.png 187 | /caffe/drive_rc/images/yardp.fg/0102.jpg /caffe/drive_rc/images/yardp.seg/0102.png 188 | /caffe/drive_rc/images/negs/MDAlarm_20160623-212204.jpg /caffe/drive_rc/images/empty_seg.png 189 | /caffe/drive_rc/images/yard.fg/0007.jpg /caffe/drive_rc/images/yard.seg/0007.png 190 | /caffe/drive_rc/images/yard.fg/0184.jpg /caffe/drive_rc/images/yard.seg/0184.png 191 | /caffe/drive_rc/images/negs/MDAlarm_20160619-173423.jpg /caffe/drive_rc/images/empty_seg.png 192 | /caffe/drive_rc/images/yard.fg/0255.jpg /caffe/drive_rc/images/yard.seg/0255.png 193 | /caffe/drive_rc/images/negs/MDAlarm_20160618-232402.jpg /caffe/drive_rc/images/empty_seg.png 194 | /caffe/drive_rc/images/yardp.fg/0026.jpg /caffe/drive_rc/images/yardp.seg/0026.png 195 | /caffe/drive_rc/images/negs/MDAlarm_20160619-173426.jpg /caffe/drive_rc/images/empty_seg.png 196 | /caffe/drive_rc/images/yard.fg/0075.jpg /caffe/drive_rc/images/yard.seg/0075.png 197 | /caffe/drive_rc/images/negs/MDAlarm_20160620-082907.jpg /caffe/drive_rc/images/empty_seg.png 198 | /caffe/drive_rc/images/yardp.fg/0189.jpg /caffe/drive_rc/images/yardp.seg/0189.png 199 | /caffe/drive_rc/images/yardp.fg/0051.jpg /caffe/drive_rc/images/yardp.seg/0051.png 200 | /caffe/drive_rc/images/yard.fg/0103.jpg /caffe/drive_rc/images/yard.seg/0103.png 201 | /caffe/drive_rc/images/yard.fg/0207.jpg /caffe/drive_rc/images/yard.seg/0207.png 202 | /caffe/drive_rc/images/yard.fg/0186.jpg /caffe/drive_rc/images/yard.seg/0186.png 203 | /caffe/drive_rc/images/yardp.fg/0134.jpg /caffe/drive_rc/images/yardp.seg/0134.png 204 | /caffe/drive_rc/images/yard.fg/0018.jpg /caffe/drive_rc/images/yard.seg/0018.png 205 | /caffe/drive_rc/images/yard.fg/0074.jpg /caffe/drive_rc/images/yard.seg/0074.png 206 | /caffe/drive_rc/images/yard.fg/0014.jpg /caffe/drive_rc/images/yard.seg/0014.png 207 | /caffe/drive_rc/images/yardp.fg/0078.jpg /caffe/drive_rc/images/yardp.seg/0078.png 208 | /caffe/drive_rc/images/yardp.fg/0010.jpg /caffe/drive_rc/images/yardp.seg/0010.png 209 | /caffe/drive_rc/images/negs/MDAlarm_20160620-113617.jpg /caffe/drive_rc/images/empty_seg.png 210 | /caffe/drive_rc/images/yard.fg/0284.jpg /caffe/drive_rc/images/yard.seg/0284.png 211 | /caffe/drive_rc/images/yard.fg/0084.jpg /caffe/drive_rc/images/yard.seg/0084.png 212 | /caffe/drive_rc/images/yard.fg/0219.jpg /caffe/drive_rc/images/yard.seg/0219.png 213 | /caffe/drive_rc/images/yard.fg/0295.jpg /caffe/drive_rc/images/yard.seg/0295.png 214 | /caffe/drive_rc/images/yardp.fg/0123.jpg /caffe/drive_rc/images/yardp.seg/0123.png 215 | /caffe/drive_rc/images/yardp.fg/0031.jpg /caffe/drive_rc/images/yardp.seg/0031.png 216 | /caffe/drive_rc/images/yard.fg/0193.jpg /caffe/drive_rc/images/yard.seg/0193.png 217 | /caffe/drive_rc/images/yardp.fg/0191.jpg /caffe/drive_rc/images/yardp.seg/0191.png 218 | /caffe/drive_rc/images/yardp.fg/0039.jpg /caffe/drive_rc/images/yardp.seg/0039.png 219 | /caffe/drive_rc/images/yardp.fg/0121.jpg /caffe/drive_rc/images/yardp.seg/0121.png 220 | /caffe/drive_rc/images/yard.fg/0293.jpg /caffe/drive_rc/images/yard.seg/0293.png 221 | /caffe/drive_rc/images/yard.fg/0168.jpg /caffe/drive_rc/images/yard.seg/0168.png 222 | /caffe/drive_rc/images/yardp.fg/0024.jpg /caffe/drive_rc/images/yardp.seg/0024.png 223 | /caffe/drive_rc/images/yard.fg/0053.jpg /caffe/drive_rc/images/yard.seg/0053.png 224 | /caffe/drive_rc/images/negs/MDAlarm_20160619-174358.jpg /caffe/drive_rc/images/empty_seg.png 225 | /caffe/drive_rc/images/yard.fg/0135.jpg /caffe/drive_rc/images/yard.seg/0135.png 226 | /caffe/drive_rc/images/yardp.fg/0112.jpg /caffe/drive_rc/images/yardp.seg/0112.png 227 | /caffe/drive_rc/images/yard.fg/0260.jpg /caffe/drive_rc/images/yard.seg/0260.png 228 | /caffe/drive_rc/images/negs/MDAlarm_20160619-174352.jpg /caffe/drive_rc/images/empty_seg.png 229 | /caffe/drive_rc/images/negs/MDAlarm_20160621-174504.jpg /caffe/drive_rc/images/empty_seg.png 230 | /caffe/drive_rc/images/yardp.fg/0172.jpg /caffe/drive_rc/images/yardp.seg/0172.png 231 | /caffe/drive_rc/images/yardp.fg/0198.jpg /caffe/drive_rc/images/yardp.seg/0198.png 232 | /caffe/drive_rc/images/yard.fg/0160.jpg /caffe/drive_rc/images/yard.seg/0160.png 233 | /caffe/drive_rc/images/yard.fg/0261.jpg /caffe/drive_rc/images/yard.seg/0261.png 234 | /caffe/drive_rc/images/yardp.fg/0145.jpg /caffe/drive_rc/images/yardp.seg/0145.png 235 | /caffe/drive_rc/images/yard.fg/0052.jpg /caffe/drive_rc/images/yard.seg/0052.png 236 | /caffe/drive_rc/images/yardp.fg/0150.jpg /caffe/drive_rc/images/yardp.seg/0150.png 237 | /caffe/drive_rc/images/yard.fg/0230.jpg /caffe/drive_rc/images/yard.seg/0230.png 238 | /caffe/drive_rc/images/yardp.fg/0009.jpg /caffe/drive_rc/images/yardp.seg/0009.png 239 | /caffe/drive_rc/images/yardp.fg/0082.jpg /caffe/drive_rc/images/yardp.seg/0082.png 240 | /caffe/drive_rc/images/yard.fg/0021.jpg /caffe/drive_rc/images/yard.seg/0021.png 241 | /caffe/drive_rc/images/yardp.fg/0199.jpg /caffe/drive_rc/images/yardp.seg/0199.png 242 | /caffe/drive_rc/images/yard.fg/0229.jpg /caffe/drive_rc/images/yard.seg/0229.png 243 | /caffe/drive_rc/images/yard.fg/0266.jpg /caffe/drive_rc/images/yard.seg/0266.png 244 | /caffe/drive_rc/images/yard.fg/0179.jpg /caffe/drive_rc/images/yard.seg/0179.png 245 | /caffe/drive_rc/images/negs/MDAlarm_20160621-083741.jpg /caffe/drive_rc/images/empty_seg.png 246 | /caffe/drive_rc/images/yard.fg/0176.jpg /caffe/drive_rc/images/yard.seg/0176.png 247 | /caffe/drive_rc/images/yard.fg/0198.jpg /caffe/drive_rc/images/yard.seg/0198.png 248 | /caffe/drive_rc/images/yardp.fg/0084.jpg /caffe/drive_rc/images/yardp.seg/0084.png 249 | /caffe/drive_rc/images/yardp.fg/0110.jpg /caffe/drive_rc/images/yardp.seg/0110.png 250 | /caffe/drive_rc/images/yard.fg/0283.jpg /caffe/drive_rc/images/yard.seg/0283.png 251 | /caffe/drive_rc/images/negs/MDAlarm_20160607-082523.jpg /caffe/drive_rc/images/empty_seg.png 252 | /caffe/drive_rc/images/yard.fg/0289.jpg /caffe/drive_rc/images/yard.seg/0289.png 253 | /caffe/drive_rc/images/yardp.fg/0083.jpg /caffe/drive_rc/images/yardp.seg/0083.png 254 | /caffe/drive_rc/images/yard.fg/0118.jpg /caffe/drive_rc/images/yard.seg/0118.png 255 | /caffe/drive_rc/images/negs/MDAlarm_20160622-083607.jpg /caffe/drive_rc/images/empty_seg.png 256 | /caffe/drive_rc/images/yardp.fg/0093.jpg /caffe/drive_rc/images/yardp.seg/0093.png 257 | /caffe/drive_rc/images/yard.fg/0276.jpg /caffe/drive_rc/images/yard.seg/0276.png 258 | /caffe/drive_rc/images/yardp.fg/0090.jpg /caffe/drive_rc/images/yardp.seg/0090.png 259 | /caffe/drive_rc/images/yard.fg/0131.jpg /caffe/drive_rc/images/yard.seg/0131.png 260 | /caffe/drive_rc/images/yardp.fg/0048.jpg /caffe/drive_rc/images/yardp.seg/0048.png 261 | /caffe/drive_rc/images/yardp.fg/0126.jpg /caffe/drive_rc/images/yardp.seg/0126.png 262 | /caffe/drive_rc/images/yard.fg/0149.jpg /caffe/drive_rc/images/yard.seg/0149.png 263 | /caffe/drive_rc/images/negs/MDAlarm_20160620-073522.jpg /caffe/drive_rc/images/empty_seg.png 264 | /caffe/drive_rc/images/yardp.fg/0180.jpg /caffe/drive_rc/images/yardp.seg/0180.png 265 | /caffe/drive_rc/images/yardp.fg/0070.jpg /caffe/drive_rc/images/yardp.seg/0070.png 266 | /caffe/drive_rc/images/yard.fg/0200.jpg /caffe/drive_rc/images/yard.seg/0200.png 267 | /caffe/drive_rc/images/yardp.fg/0003.jpg /caffe/drive_rc/images/yardp.seg/0003.png 268 | /caffe/drive_rc/images/negs/MDAlarm_20160620-083720.jpg /caffe/drive_rc/images/empty_seg.png 269 | /caffe/drive_rc/images/yard.fg/0164.jpg /caffe/drive_rc/images/yard.seg/0164.png 270 | /caffe/drive_rc/images/yard.fg/0036.jpg /caffe/drive_rc/images/yard.seg/0036.png 271 | /caffe/drive_rc/images/yardp.fg/0022.jpg /caffe/drive_rc/images/yardp.seg/0022.png 272 | /caffe/drive_rc/images/yard.fg/0124.jpg /caffe/drive_rc/images/yard.seg/0124.png 273 | /caffe/drive_rc/images/yardp.fg/0116.jpg /caffe/drive_rc/images/yardp.seg/0116.png 274 | /caffe/drive_rc/images/yard.fg/0148.jpg /caffe/drive_rc/images/yard.seg/0148.png 275 | /caffe/drive_rc/images/yard.fg/0109.jpg /caffe/drive_rc/images/yard.seg/0109.png 276 | /caffe/drive_rc/images/yard.fg/0030.jpg /caffe/drive_rc/images/yard.seg/0030.png 277 | /caffe/drive_rc/images/negs/MDAlarm_20160619-100336.jpg /caffe/drive_rc/images/empty_seg.png 278 | /caffe/drive_rc/images/yardp.fg/0104.jpg /caffe/drive_rc/images/yardp.seg/0104.png 279 | /caffe/drive_rc/images/negs/MDAlarm_20160618-230929.jpg /caffe/drive_rc/images/empty_seg.png 280 | /caffe/drive_rc/images/yardp.fg/0055.jpg /caffe/drive_rc/images/yardp.seg/0055.png 281 | /caffe/drive_rc/images/yardp.fg/0111.jpg /caffe/drive_rc/images/yardp.seg/0111.png 282 | /caffe/drive_rc/images/yardp.fg/0027.jpg /caffe/drive_rc/images/yardp.seg/0027.png 283 | /caffe/drive_rc/images/yard.fg/0054.jpg /caffe/drive_rc/images/yard.seg/0054.png 284 | /caffe/drive_rc/images/yard.fg/0228.jpg /caffe/drive_rc/images/yard.seg/0228.png 285 | /caffe/drive_rc/images/yard.fg/0023.jpg /caffe/drive_rc/images/yard.seg/0023.png 286 | /caffe/drive_rc/images/yard.fg/0028.jpg /caffe/drive_rc/images/yard.seg/0028.png 287 | /caffe/drive_rc/images/yardp.fg/0060.jpg /caffe/drive_rc/images/yardp.seg/0060.png 288 | /caffe/drive_rc/images/yard.fg/0008.jpg /caffe/drive_rc/images/yard.seg/0008.png 289 | /caffe/drive_rc/images/yard.fg/0155.jpg /caffe/drive_rc/images/yard.seg/0155.png 290 | /caffe/drive_rc/images/yard.fg/0059.jpg /caffe/drive_rc/images/yard.seg/0059.png 291 | /caffe/drive_rc/images/yard.fg/0221.jpg /caffe/drive_rc/images/yard.seg/0221.png 292 | /caffe/drive_rc/images/yard.fg/0111.jpg /caffe/drive_rc/images/yard.seg/0111.png 293 | /caffe/drive_rc/images/yardp.fg/0160.jpg /caffe/drive_rc/images/yardp.seg/0160.png 294 | /caffe/drive_rc/images/yardp.fg/0089.jpg /caffe/drive_rc/images/yardp.seg/0089.png 295 | /caffe/drive_rc/images/yard.fg/0201.jpg /caffe/drive_rc/images/yard.seg/0201.png 296 | /caffe/drive_rc/images/yard.fg/0100.jpg /caffe/drive_rc/images/yard.seg/0100.png 297 | /caffe/drive_rc/images/yard.fg/0153.jpg /caffe/drive_rc/images/yard.seg/0153.png 298 | /caffe/drive_rc/images/yardp.fg/0073.jpg /caffe/drive_rc/images/yardp.seg/0073.png 299 | /caffe/drive_rc/images/yardp.fg/0047.jpg /caffe/drive_rc/images/yardp.seg/0047.png 300 | /caffe/drive_rc/images/yard.fg/0262.jpg /caffe/drive_rc/images/yard.seg/0262.png 301 | /caffe/drive_rc/images/yard.fg/0257.jpg /caffe/drive_rc/images/yard.seg/0257.png 302 | /caffe/drive_rc/images/yard.fg/0259.jpg /caffe/drive_rc/images/yard.seg/0259.png 303 | /caffe/drive_rc/images/yard.fg/0117.jpg /caffe/drive_rc/images/yard.seg/0117.png 304 | /caffe/drive_rc/images/yardp.fg/0066.jpg /caffe/drive_rc/images/yardp.seg/0066.png 305 | /caffe/drive_rc/images/yardp.fg/0196.jpg /caffe/drive_rc/images/yardp.seg/0196.png 306 | /caffe/drive_rc/images/negs/MDAlarm_20160619-100335.jpg /caffe/drive_rc/images/empty_seg.png 307 | /caffe/drive_rc/images/negs/MDAlarm_20160619-173424.jpg /caffe/drive_rc/images/empty_seg.png 308 | /caffe/drive_rc/images/yard.fg/0032.jpg /caffe/drive_rc/images/yard.seg/0032.png 309 | /caffe/drive_rc/images/yard.fg/0169.jpg /caffe/drive_rc/images/yard.seg/0169.png 310 | /caffe/drive_rc/images/yard.fg/0022.jpg /caffe/drive_rc/images/yard.seg/0022.png 311 | /caffe/drive_rc/images/yardp.fg/0098.jpg /caffe/drive_rc/images/yardp.seg/0098.png 312 | /caffe/drive_rc/images/yard.fg/0045.jpg /caffe/drive_rc/images/yard.seg/0045.png 313 | /caffe/drive_rc/images/negs/MDAlarm_20160616-123829.jpg /caffe/drive_rc/images/empty_seg.png 314 | /caffe/drive_rc/images/yardp.fg/0095.jpg /caffe/drive_rc/images/yardp.seg/0095.png 315 | /caffe/drive_rc/images/yardp.fg/0042.jpg /caffe/drive_rc/images/yardp.seg/0042.png 316 | /caffe/drive_rc/images/yardp.fg/0113.jpg /caffe/drive_rc/images/yardp.seg/0113.png 317 | /caffe/drive_rc/images/yardp.fg/0014.jpg /caffe/drive_rc/images/yardp.seg/0014.png 318 | /caffe/drive_rc/images/yard.fg/0265.jpg /caffe/drive_rc/images/yard.seg/0265.png 319 | /caffe/drive_rc/images/yardp.fg/0120.jpg /caffe/drive_rc/images/yardp.seg/0120.png 320 | /caffe/drive_rc/images/yard.fg/0245.jpg /caffe/drive_rc/images/yard.seg/0245.png 321 | /caffe/drive_rc/images/yardp.fg/0109.jpg /caffe/drive_rc/images/yardp.seg/0109.png 322 | /caffe/drive_rc/images/negs/MDAlarm_20160620-113623.jpg /caffe/drive_rc/images/empty_seg.png 323 | /caffe/drive_rc/images/yard.fg/0163.jpg /caffe/drive_rc/images/yard.seg/0163.png 324 | /caffe/drive_rc/images/yardp.fg/0028.jpg /caffe/drive_rc/images/yardp.seg/0028.png 325 | /caffe/drive_rc/images/yard.fg/0037.jpg /caffe/drive_rc/images/yard.seg/0037.png 326 | /caffe/drive_rc/images/yardp.fg/0173.jpg /caffe/drive_rc/images/yardp.seg/0173.png 327 | /caffe/drive_rc/images/yard.fg/0297.jpg /caffe/drive_rc/images/yard.seg/0297.png 328 | /caffe/drive_rc/images/yardp.fg/0038.jpg /caffe/drive_rc/images/yardp.seg/0038.png 329 | /caffe/drive_rc/images/yard.fg/0081.jpg /caffe/drive_rc/images/yard.seg/0081.png 330 | /caffe/drive_rc/images/negs/MDAlarm_20160620-113621.jpg /caffe/drive_rc/images/empty_seg.png 331 | /caffe/drive_rc/images/yard.fg/0026.jpg /caffe/drive_rc/images/yard.seg/0026.png 332 | /caffe/drive_rc/images/yard.fg/0174.jpg /caffe/drive_rc/images/yard.seg/0174.png 333 | /caffe/drive_rc/images/yard.fg/0154.jpg /caffe/drive_rc/images/yard.seg/0154.png 334 | /caffe/drive_rc/images/yard.fg/0003.jpg /caffe/drive_rc/images/yard.seg/0003.png 335 | /caffe/drive_rc/images/yard.fg/0029.jpg /caffe/drive_rc/images/yard.seg/0029.png 336 | /caffe/drive_rc/images/yard.fg/0140.jpg /caffe/drive_rc/images/yard.seg/0140.png 337 | /caffe/drive_rc/images/yardp.fg/0034.jpg /caffe/drive_rc/images/yardp.seg/0034.png 338 | /caffe/drive_rc/images/yard.fg/0166.jpg /caffe/drive_rc/images/yard.seg/0166.png 339 | /caffe/drive_rc/images/yard.fg/0175.jpg /caffe/drive_rc/images/yard.seg/0175.png 340 | /caffe/drive_rc/images/yard.fg/0299.jpg /caffe/drive_rc/images/yard.seg/0299.png 341 | /caffe/drive_rc/images/yard.fg/0012.jpg /caffe/drive_rc/images/yard.seg/0012.png 342 | /caffe/drive_rc/images/yardp.fg/0065.jpg /caffe/drive_rc/images/yardp.seg/0065.png 343 | /caffe/drive_rc/images/yardp.fg/0142.jpg /caffe/drive_rc/images/yardp.seg/0142.png 344 | /caffe/drive_rc/images/yard.fg/0236.jpg /caffe/drive_rc/images/yard.seg/0236.png 345 | /caffe/drive_rc/images/yard.fg/0115.jpg /caffe/drive_rc/images/yard.seg/0115.png 346 | /caffe/drive_rc/images/yardp.fg/0017.jpg /caffe/drive_rc/images/yardp.seg/0017.png 347 | /caffe/drive_rc/images/yardp.fg/0076.jpg /caffe/drive_rc/images/yardp.seg/0076.png 348 | /caffe/drive_rc/images/yard.fg/0035.jpg /caffe/drive_rc/images/yard.seg/0035.png 349 | /caffe/drive_rc/images/yard.fg/0001.jpg /caffe/drive_rc/images/yard.seg/0001.png 350 | /caffe/drive_rc/images/yardp.fg/0137.jpg /caffe/drive_rc/images/yardp.seg/0137.png 351 | /caffe/drive_rc/images/yard.fg/0150.jpg /caffe/drive_rc/images/yard.seg/0150.png 352 | /caffe/drive_rc/images/yard.fg/0258.jpg /caffe/drive_rc/images/yard.seg/0258.png 353 | /caffe/drive_rc/images/yardp.fg/0002.jpg /caffe/drive_rc/images/yardp.seg/0002.png 354 | /caffe/drive_rc/images/negs/MDAlarm_20160618-173502.jpg /caffe/drive_rc/images/empty_seg.png 355 | /caffe/drive_rc/images/yard.fg/0244.jpg /caffe/drive_rc/images/yard.seg/0244.png 356 | /caffe/drive_rc/images/yard.fg/0210.jpg /caffe/drive_rc/images/yard.seg/0210.png 357 | /caffe/drive_rc/images/yardp.fg/0186.jpg /caffe/drive_rc/images/yardp.seg/0186.png 358 | /caffe/drive_rc/images/yardp.fg/0175.jpg /caffe/drive_rc/images/yardp.seg/0175.png 359 | /caffe/drive_rc/images/yardp.fg/0054.jpg /caffe/drive_rc/images/yardp.seg/0054.png 360 | /caffe/drive_rc/images/yard.fg/0049.jpg /caffe/drive_rc/images/yard.seg/0049.png 361 | /caffe/drive_rc/images/yard.fg/0110.jpg /caffe/drive_rc/images/yard.seg/0110.png 362 | /caffe/drive_rc/images/yard.fg/0248.jpg /caffe/drive_rc/images/yard.seg/0248.png 363 | /caffe/drive_rc/images/yardp.fg/0029.jpg /caffe/drive_rc/images/yardp.seg/0029.png 364 | /caffe/drive_rc/images/yardp.fg/0143.jpg /caffe/drive_rc/images/yardp.seg/0143.png 365 | /caffe/drive_rc/images/yardp.fg/0061.jpg /caffe/drive_rc/images/yardp.seg/0061.png 366 | /caffe/drive_rc/images/yard.fg/0194.jpg /caffe/drive_rc/images/yard.seg/0194.png 367 | /caffe/drive_rc/images/negs/MDAlarm_20160623-225248.jpg /caffe/drive_rc/images/empty_seg.png 368 | /caffe/drive_rc/images/yard.fg/0004.jpg /caffe/drive_rc/images/yard.seg/0004.png 369 | /caffe/drive_rc/images/yard.fg/0298.jpg /caffe/drive_rc/images/yard.seg/0298.png 370 | /caffe/drive_rc/images/yard.fg/0134.jpg /caffe/drive_rc/images/yard.seg/0134.png 371 | /caffe/drive_rc/images/yard.fg/0240.jpg /caffe/drive_rc/images/yard.seg/0240.png 372 | /caffe/drive_rc/images/yardp.fg/0141.jpg /caffe/drive_rc/images/yardp.seg/0141.png 373 | /caffe/drive_rc/images/yardp.fg/0063.jpg /caffe/drive_rc/images/yardp.seg/0063.png 374 | /caffe/drive_rc/images/yardp.fg/0200.jpg /caffe/drive_rc/images/yardp.seg/0200.png 375 | /caffe/drive_rc/images/yardp.fg/0146.jpg /caffe/drive_rc/images/yardp.seg/0146.png 376 | /caffe/drive_rc/images/negs/MDAlarm_20160623-223544.jpg /caffe/drive_rc/images/empty_seg.png 377 | /caffe/drive_rc/images/negs/MDAlarm_20160619-174534.jpg /caffe/drive_rc/images/empty_seg.png 378 | /caffe/drive_rc/images/yard.fg/0071.jpg /caffe/drive_rc/images/yard.seg/0071.png 379 | /caffe/drive_rc/images/yardp.fg/0167.jpg /caffe/drive_rc/images/yardp.seg/0167.png 380 | /caffe/drive_rc/images/yard.fg/0106.jpg /caffe/drive_rc/images/yard.seg/0106.png 381 | /caffe/drive_rc/images/yard.fg/0182.jpg /caffe/drive_rc/images/yard.seg/0182.png 382 | /caffe/drive_rc/images/yard.fg/0098.jpg /caffe/drive_rc/images/yard.seg/0098.png 383 | /caffe/drive_rc/images/yardp.fg/0117.jpg /caffe/drive_rc/images/yardp.seg/0117.png 384 | /caffe/drive_rc/images/yard.fg/0076.jpg /caffe/drive_rc/images/yard.seg/0076.png 385 | /caffe/drive_rc/images/yardp.fg/0075.jpg /caffe/drive_rc/images/yardp.seg/0075.png 386 | /caffe/drive_rc/images/yard.fg/0077.jpg /caffe/drive_rc/images/yard.seg/0077.png 387 | /caffe/drive_rc/images/yard.fg/0087.jpg /caffe/drive_rc/images/yard.seg/0087.png 388 | /caffe/drive_rc/images/yard.fg/0119.jpg /caffe/drive_rc/images/yard.seg/0119.png 389 | /caffe/drive_rc/images/negs/MDAlarm_20160620-173654.jpg /caffe/drive_rc/images/empty_seg.png 390 | /caffe/drive_rc/images/negs/MDAlarm_20160619-174535.jpg /caffe/drive_rc/images/empty_seg.png 391 | /caffe/drive_rc/images/yardp.fg/0040.jpg /caffe/drive_rc/images/yardp.seg/0040.png 392 | /caffe/drive_rc/images/yardp.fg/0096.jpg /caffe/drive_rc/images/yardp.seg/0096.png 393 | /caffe/drive_rc/images/yardp.fg/0185.jpg /caffe/drive_rc/images/yardp.seg/0185.png 394 | /caffe/drive_rc/images/yard.fg/0197.jpg /caffe/drive_rc/images/yard.seg/0197.png 395 | /caffe/drive_rc/images/yardp.fg/0069.jpg /caffe/drive_rc/images/yardp.seg/0069.png 396 | /caffe/drive_rc/images/yard.fg/0138.jpg /caffe/drive_rc/images/yard.seg/0138.png 397 | /caffe/drive_rc/images/yard.fg/0254.jpg /caffe/drive_rc/images/yard.seg/0254.png 398 | /caffe/drive_rc/images/yard.fg/0051.jpg /caffe/drive_rc/images/yard.seg/0051.png 399 | /caffe/drive_rc/images/yard.fg/0127.jpg /caffe/drive_rc/images/yard.seg/0127.png 400 | /caffe/drive_rc/images/negs/MDAlarm_20160620-183014.jpg /caffe/drive_rc/images/empty_seg.png 401 | /caffe/drive_rc/images/yardp.fg/0091.jpg /caffe/drive_rc/images/yardp.seg/0091.png 402 | /caffe/drive_rc/images/yardp.fg/0079.jpg /caffe/drive_rc/images/yardp.seg/0079.png 403 | /caffe/drive_rc/images/yard.fg/0033.jpg /caffe/drive_rc/images/yard.seg/0033.png 404 | /caffe/drive_rc/images/yard.fg/0066.jpg /caffe/drive_rc/images/yard.seg/0066.png 405 | /caffe/drive_rc/images/yard.fg/0010.jpg /caffe/drive_rc/images/yard.seg/0010.png 406 | /caffe/drive_rc/images/yard.fg/0096.jpg /caffe/drive_rc/images/yard.seg/0096.png 407 | /caffe/drive_rc/images/yardp.fg/0129.jpg /caffe/drive_rc/images/yardp.seg/0129.png 408 | /caffe/drive_rc/images/yard.fg/0272.jpg /caffe/drive_rc/images/yard.seg/0272.png 409 | /caffe/drive_rc/images/yardp.fg/0183.jpg /caffe/drive_rc/images/yardp.seg/0183.png 410 | /caffe/drive_rc/images/yard.fg/0128.jpg /caffe/drive_rc/images/yard.seg/0128.png 411 | /caffe/drive_rc/images/yardp.fg/0179.jpg /caffe/drive_rc/images/yardp.seg/0179.png 412 | /caffe/drive_rc/images/yardp.fg/0169.jpg /caffe/drive_rc/images/yardp.seg/0169.png 413 | /caffe/drive_rc/images/yardp.fg/0021.jpg /caffe/drive_rc/images/yardp.seg/0021.png 414 | /caffe/drive_rc/images/yard.fg/0196.jpg /caffe/drive_rc/images/yard.seg/0196.png 415 | /caffe/drive_rc/images/yard.fg/0058.jpg /caffe/drive_rc/images/yard.seg/0058.png 416 | /caffe/drive_rc/images/yard.fg/0027.jpg /caffe/drive_rc/images/yard.seg/0027.png 417 | /caffe/drive_rc/images/yard.fg/0099.jpg /caffe/drive_rc/images/yard.seg/0099.png 418 | /caffe/drive_rc/images/yard.fg/0157.jpg /caffe/drive_rc/images/yard.seg/0157.png 419 | /caffe/drive_rc/images/yard.fg/0285.jpg /caffe/drive_rc/images/yard.seg/0285.png 420 | /caffe/drive_rc/images/yard.fg/0019.jpg /caffe/drive_rc/images/yard.seg/0019.png 421 | /caffe/drive_rc/images/yard.fg/0172.jpg /caffe/drive_rc/images/yard.seg/0172.png 422 | /caffe/drive_rc/images/yard.fg/0180.jpg /caffe/drive_rc/images/yard.seg/0180.png 423 | /caffe/drive_rc/images/negs/MDAlarm_20160618-171250.jpg /caffe/drive_rc/images/empty_seg.png 424 | /caffe/drive_rc/images/yard.fg/0139.jpg /caffe/drive_rc/images/yard.seg/0139.png 425 | /caffe/drive_rc/images/yardp.fg/0106.jpg /caffe/drive_rc/images/yardp.seg/0106.png 426 | /caffe/drive_rc/images/yard.fg/0213.jpg /caffe/drive_rc/images/yard.seg/0213.png 427 | /caffe/drive_rc/images/yard.fg/0086.jpg /caffe/drive_rc/images/yard.seg/0086.png 428 | /caffe/drive_rc/images/negs/MDAlarm_20160620-200257.jpg /caffe/drive_rc/images/empty_seg.png 429 | /caffe/drive_rc/images/yard.fg/0246.jpg /caffe/drive_rc/images/yard.seg/0246.png 430 | /caffe/drive_rc/images/negs/MDAlarm_20160619-174353.jpg /caffe/drive_rc/images/empty_seg.png 431 | /caffe/drive_rc/images/yard.fg/0101.jpg /caffe/drive_rc/images/yard.seg/0101.png 432 | /caffe/drive_rc/images/yard.fg/0104.jpg /caffe/drive_rc/images/yard.seg/0104.png 433 | /caffe/drive_rc/images/yardp.fg/0138.jpg /caffe/drive_rc/images/yardp.seg/0138.png 434 | /caffe/drive_rc/images/yard.fg/0129.jpg /caffe/drive_rc/images/yard.seg/0129.png 435 | /caffe/drive_rc/images/yard.fg/0107.jpg /caffe/drive_rc/images/yard.seg/0107.png 436 | /caffe/drive_rc/images/yardp.fg/0140.jpg /caffe/drive_rc/images/yardp.seg/0140.png 437 | /caffe/drive_rc/images/negs/MDAlarm_20160619-100818.jpg /caffe/drive_rc/images/empty_seg.png 438 | /caffe/drive_rc/images/yard.fg/0178.jpg /caffe/drive_rc/images/yard.seg/0178.png 439 | /caffe/drive_rc/images/yard.fg/0137.jpg /caffe/drive_rc/images/yard.seg/0137.png 440 | /caffe/drive_rc/images/yard.fg/0043.jpg /caffe/drive_rc/images/yard.seg/0043.png 441 | /caffe/drive_rc/images/yard.fg/0105.jpg /caffe/drive_rc/images/yard.seg/0105.png 442 | /caffe/drive_rc/images/yard.fg/0020.jpg /caffe/drive_rc/images/yard.seg/0020.png 443 | /caffe/drive_rc/images/yardp.fg/0037.jpg /caffe/drive_rc/images/yardp.seg/0037.png 444 | /caffe/drive_rc/images/yardp.fg/0105.jpg /caffe/drive_rc/images/yardp.seg/0105.png 445 | /caffe/drive_rc/images/yard.fg/0152.jpg /caffe/drive_rc/images/yard.seg/0152.png 446 | /caffe/drive_rc/images/yard.fg/0162.jpg /caffe/drive_rc/images/yard.seg/0162.png 447 | /caffe/drive_rc/images/negs/MDAlarm_20160620-083643.jpg /caffe/drive_rc/images/empty_seg.png 448 | /caffe/drive_rc/images/yard.fg/0002.jpg /caffe/drive_rc/images/yard.seg/0002.png 449 | /caffe/drive_rc/images/yard.fg/0144.jpg /caffe/drive_rc/images/yard.seg/0144.png 450 | /caffe/drive_rc/images/yardp.fg/0119.jpg /caffe/drive_rc/images/yardp.seg/0119.png 451 | /caffe/drive_rc/images/yard.fg/0067.jpg /caffe/drive_rc/images/yard.seg/0067.png 452 | /caffe/drive_rc/images/yard.fg/0170.jpg /caffe/drive_rc/images/yard.seg/0170.png 453 | /caffe/drive_rc/images/yardp.fg/0122.jpg /caffe/drive_rc/images/yardp.seg/0122.png 454 | /caffe/drive_rc/images/yard.fg/0069.jpg /caffe/drive_rc/images/yard.seg/0069.png 455 | /caffe/drive_rc/images/yardp.fg/0085.jpg /caffe/drive_rc/images/yardp.seg/0085.png 456 | /caffe/drive_rc/images/yardp.fg/0156.jpg /caffe/drive_rc/images/yardp.seg/0156.png 457 | /caffe/drive_rc/images/negs/MDAlarm_20160620-083719.jpg /caffe/drive_rc/images/empty_seg.png 458 | /caffe/drive_rc/images/yard.fg/0065.jpg /caffe/drive_rc/images/yard.seg/0065.png 459 | /caffe/drive_rc/images/yard.fg/0114.jpg /caffe/drive_rc/images/yard.seg/0114.png 460 | /caffe/drive_rc/images/yard.fg/0241.jpg /caffe/drive_rc/images/yard.seg/0241.png 461 | /caffe/drive_rc/images/yard.fg/0056.jpg /caffe/drive_rc/images/yard.seg/0056.png 462 | /caffe/drive_rc/images/yard.fg/0189.jpg /caffe/drive_rc/images/yard.seg/0189.png 463 | /caffe/drive_rc/images/yard.fg/0159.jpg /caffe/drive_rc/images/yard.seg/0159.png 464 | /caffe/drive_rc/images/yard.fg/0167.jpg /caffe/drive_rc/images/yard.seg/0167.png 465 | /caffe/drive_rc/images/yardp.fg/0072.jpg /caffe/drive_rc/images/yardp.seg/0072.png 466 | /caffe/drive_rc/images/yardp.fg/0159.jpg /caffe/drive_rc/images/yardp.seg/0159.png 467 | /caffe/drive_rc/images/negs/MDAlarm_20160621-174503.jpg /caffe/drive_rc/images/empty_seg.png 468 | /caffe/drive_rc/images/yard.fg/0250.jpg /caffe/drive_rc/images/yard.seg/0250.png 469 | /caffe/drive_rc/images/yard.fg/0017.jpg /caffe/drive_rc/images/yard.seg/0017.png 470 | /caffe/drive_rc/images/yardp.fg/0163.jpg /caffe/drive_rc/images/yardp.seg/0163.png 471 | /caffe/drive_rc/images/yardp.fg/0056.jpg /caffe/drive_rc/images/yardp.seg/0056.png 472 | /caffe/drive_rc/images/yard.fg/0143.jpg /caffe/drive_rc/images/yard.seg/0143.png 473 | /caffe/drive_rc/images/negs/MDAlarm_20160619-174533.jpg /caffe/drive_rc/images/empty_seg.png 474 | /caffe/drive_rc/images/yard.fg/0242.jpg /caffe/drive_rc/images/yard.seg/0242.png 475 | /caffe/drive_rc/images/yardp.fg/0184.jpg /caffe/drive_rc/images/yardp.seg/0184.png 476 | /caffe/drive_rc/images/yardp.fg/0032.jpg /caffe/drive_rc/images/yardp.seg/0032.png 477 | /caffe/drive_rc/images/yard.fg/0222.jpg /caffe/drive_rc/images/yard.seg/0222.png 478 | /caffe/drive_rc/images/negs/MDAlarm_20160620-141856.jpg /caffe/drive_rc/images/empty_seg.png 479 | /caffe/drive_rc/images/yardp.fg/0153.jpg /caffe/drive_rc/images/yardp.seg/0153.png 480 | /caffe/drive_rc/images/yard.fg/0047.jpg /caffe/drive_rc/images/yard.seg/0047.png 481 | /caffe/drive_rc/images/yardp.fg/0049.jpg /caffe/drive_rc/images/yardp.seg/0049.png 482 | /caffe/drive_rc/images/yard.fg/0130.jpg /caffe/drive_rc/images/yard.seg/0130.png 483 | /caffe/drive_rc/images/yardp.fg/0087.jpg /caffe/drive_rc/images/yardp.seg/0087.png 484 | /caffe/drive_rc/images/yardp.fg/0053.jpg /caffe/drive_rc/images/yardp.seg/0053.png 485 | /caffe/drive_rc/images/negs/MDAlarm_20160620-113624.jpg /caffe/drive_rc/images/empty_seg.png 486 | /caffe/drive_rc/images/yardp.fg/0041.jpg /caffe/drive_rc/images/yardp.seg/0041.png 487 | /caffe/drive_rc/images/yardp.fg/0155.jpg /caffe/drive_rc/images/yardp.seg/0155.png 488 | /caffe/drive_rc/images/yard.fg/0126.jpg /caffe/drive_rc/images/yard.seg/0126.png 489 | /caffe/drive_rc/images/yardp.fg/0107.jpg /caffe/drive_rc/images/yardp.seg/0107.png 490 | /caffe/drive_rc/images/yard.fg/0269.jpg /caffe/drive_rc/images/yard.seg/0269.png 491 | /caffe/drive_rc/images/yard.fg/0195.jpg /caffe/drive_rc/images/yard.seg/0195.png 492 | /caffe/drive_rc/images/yard.fg/0253.jpg /caffe/drive_rc/images/yard.seg/0253.png 493 | /caffe/drive_rc/images/yard.fg/0243.jpg /caffe/drive_rc/images/yard.seg/0243.png 494 | /caffe/drive_rc/images/yard.fg/0237.jpg /caffe/drive_rc/images/yard.seg/0237.png 495 | /caffe/drive_rc/images/negs/MDAlarm_20160623-225249.jpg /caffe/drive_rc/images/empty_seg.png 496 | /caffe/drive_rc/images/yard.fg/0181.jpg /caffe/drive_rc/images/yard.seg/0181.png 497 | /caffe/drive_rc/images/negs/MDAlarm_20160623-225247.jpg /caffe/drive_rc/images/empty_seg.png 498 | /caffe/drive_rc/images/yard.fg/0120.jpg /caffe/drive_rc/images/yard.seg/0120.png 499 | /caffe/drive_rc/images/yard.fg/0122.jpg /caffe/drive_rc/images/yard.seg/0122.png 500 | /caffe/drive_rc/images/yardp.fg/0188.jpg /caffe/drive_rc/images/yardp.seg/0188.png 501 | /caffe/drive_rc/images/yardp.fg/0151.jpg /caffe/drive_rc/images/yardp.seg/0151.png 502 | /caffe/drive_rc/images/yard.fg/0279.jpg /caffe/drive_rc/images/yard.seg/0279.png 503 | /caffe/drive_rc/images/yard.fg/0211.jpg /caffe/drive_rc/images/yard.seg/0211.png 504 | /caffe/drive_rc/images/yardp.fg/0132.jpg /caffe/drive_rc/images/yardp.seg/0132.png 505 | /caffe/drive_rc/images/yard.fg/0040.jpg /caffe/drive_rc/images/yard.seg/0040.png 506 | /caffe/drive_rc/images/yard.fg/0031.jpg /caffe/drive_rc/images/yard.seg/0031.png 507 | /caffe/drive_rc/images/yard.fg/0282.jpg /caffe/drive_rc/images/yard.seg/0282.png 508 | /caffe/drive_rc/images/yard.fg/0218.jpg /caffe/drive_rc/images/yard.seg/0218.png 509 | /caffe/drive_rc/images/negs/MDAlarm_20160621-180242.jpg /caffe/drive_rc/images/empty_seg.png 510 | /caffe/drive_rc/images/yardp.fg/0130.jpg /caffe/drive_rc/images/yardp.seg/0130.png 511 | /caffe/drive_rc/images/negs/MDAlarm_20160621-180237.jpg /caffe/drive_rc/images/empty_seg.png 512 | /caffe/drive_rc/images/yardp.fg/0133.jpg /caffe/drive_rc/images/yardp.seg/0133.png 513 | /caffe/drive_rc/images/yardp.fg/0165.jpg /caffe/drive_rc/images/yardp.seg/0165.png 514 | /caffe/drive_rc/images/yardp.fg/0097.jpg /caffe/drive_rc/images/yardp.seg/0097.png 515 | /caffe/drive_rc/images/yard.fg/0142.jpg /caffe/drive_rc/images/yard.seg/0142.png 516 | /caffe/drive_rc/images/negs/MDAlarm_20160619-100843.jpg /caffe/drive_rc/images/empty_seg.png 517 | /caffe/drive_rc/images/yard.fg/0085.jpg /caffe/drive_rc/images/yard.seg/0085.png 518 | /caffe/drive_rc/images/yard.fg/0274.jpg /caffe/drive_rc/images/yard.seg/0274.png 519 | -------------------------------------------------------------------------------- /fcn/batch_infer.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Takes a list of files 3 | # Saves off the segmented image 4 | 5 | import sys 6 | import time 7 | import os 8 | 9 | import numpy as np 10 | from PIL import Image 11 | 12 | import caffe 13 | 14 | caffe.set_mode_gpu() 15 | 16 | # load net 17 | net = caffe.Net('voc-fcn32s/deploy.prototxt', 'voc-fcn32s/fcn32s-heavy-pascal.caffemodel', caffe.TEST) 18 | # net = caffe.Net('pascalcontext-fcn32s/deploy.prototxt', 'pascalcontext-fcn32s/pascalcontext-fcn32s-heavy.caffemodel', caffe.TEST) 19 | 20 | for i in range(1, len(sys.argv)): 21 | # load image, switch to BGR, subtract mean, and make dims C x H x W for Caffe 22 | arg = sys.argv[i] 23 | im = Image.open(arg) 24 | in_ = np.array(im, dtype=np.float32) 25 | in_ = in_[:,:,::-1] 26 | in_ -= np.array((104.00698793,116.66876762,122.67891434)) 27 | in_ = in_.transpose((2,0,1)) 28 | 29 | # shape for input (data blob is N x C x H x W), set data 30 | net.blobs['data'].reshape(1, *in_.shape) 31 | net.blobs['data'].data[...] = in_ 32 | 33 | # run net and take argmax for prediction 34 | tic = time.clock() 35 | net.forward() 36 | toc = time.clock() 37 | print "time:", toc-tic 38 | 39 | out = net.blobs['score'].data[0].argmax(axis=0) 40 | out_8 = np.empty_like(out, dtype=np.uint8) 41 | np.copyto(out_8, out, casting='unsafe') 42 | img = Image.fromarray(out_8) 43 | 44 | fn, ext = os.path.splitext(arg) 45 | if ext == ".jpg": 46 | img.save(fn + ".png") 47 | print arg, fn + ".png" 48 | else: 49 | print "Was expecting a jpg!", arg 50 | -------------------------------------------------------------------------------- /fcn/infer.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Just like the Shellhammer version except it saves the segmented file 3 | 4 | import sys 5 | import time 6 | 7 | import numpy as np 8 | from PIL import Image 9 | 10 | import caffe 11 | 12 | # load image, switch to BGR, subtract mean, and make dims C x H x W for Caffe 13 | caffe.set_mode_gpu() 14 | 15 | im = Image.open(sys.argv[1]) 16 | in_ = np.array(im, dtype=np.float32) 17 | in_ = in_[:,:,::-1] 18 | in_ -= np.array((104.00698793,116.66876762,122.67891434)) 19 | in_ = in_.transpose((2,0,1)) 20 | 21 | # load net 22 | # net = caffe.Net('voc-fcn-alexnet/deploy.prototxt', 'voc-fcn-alexnet/fcn-alexnet-pascal.caffemodel', caffe.TEST) 23 | # net = caffe.Net('voc-fcn8s/deploy.prototxt', 'voc-fcn8s/fcn8s-heavy-pascal.caffemodel', caffe.TEST) 24 | # net = caffe.Net('voc-fcn32s/deploy.prototxt', 'voc-fcn32s/fcn32s-heavy-pascal.caffemodel', caffe.TEST) 25 | # net = caffe.Net('pascalcontext-fcn32s/deploy.prototxt', 'pascalcontext-fcn32s/pascalcontext-fcn32s-heavy.caffemodel', caffe.TEST) 26 | net = caffe.Net('rgb_voc_fcn32s/deploy.prototxt', 'rgb_voc_fcn32s/train_iter_4000.caffemodel', caffe.TEST) 27 | 28 | # shape for input (data blob is N x C x H x W), set data 29 | net.blobs['data'].reshape(1, *in_.shape) 30 | net.blobs['data'].data[...] = in_ 31 | 32 | # run net and take argmax for prediction 33 | tic = time.clock() 34 | net.forward() 35 | toc = time.clock() 36 | print toc-tic 37 | 38 | # And again for fun 39 | tic = time.clock() 40 | net.forward() 41 | toc = time.clock() 42 | print toc-tic 43 | 44 | # out = net.blobs['score'].data[0].argmax(axis=0) 45 | out = net.blobs['score'].data[0].argmax(axis=0) 46 | out_8 = np.empty_like(out, dtype=np.uint8) 47 | np.copyto(out_8, out, casting='unsafe') 48 | img = Image.fromarray(out_8) 49 | img.save("infer_out.png") 50 | -------------------------------------------------------------------------------- /fcn/rgb_voc_fcn32s/deploy.prototxt: -------------------------------------------------------------------------------- 1 | layer { 2 | name: "input" 3 | type: "Input" 4 | top: "data" 5 | input_param { 6 | # These dimensions are purely for sake of example; 7 | # see infer.py for how to reshape the net to the given input size. 8 | shape { dim: 1 dim: 3 dim: 500 dim: 500 } 9 | } 10 | } 11 | layer { 12 | name: "conv1_1" 13 | type: "Convolution" 14 | bottom: "data" 15 | top: "conv1_1" 16 | param { 17 | lr_mult: 1 18 | decay_mult: 1 19 | } 20 | param { 21 | lr_mult: 2 22 | decay_mult: 0 23 | } 24 | convolution_param { 25 | num_output: 64 26 | pad: 100 27 | kernel_size: 3 28 | stride: 1 29 | } 30 | } 31 | layer { 32 | name: "relu1_1" 33 | type: "ReLU" 34 | bottom: "conv1_1" 35 | top: "conv1_1" 36 | } 37 | layer { 38 | name: "conv1_2" 39 | type: "Convolution" 40 | bottom: "conv1_1" 41 | top: "conv1_2" 42 | param { 43 | lr_mult: 1 44 | decay_mult: 1 45 | } 46 | param { 47 | lr_mult: 2 48 | decay_mult: 0 49 | } 50 | convolution_param { 51 | num_output: 64 52 | pad: 1 53 | kernel_size: 3 54 | stride: 1 55 | } 56 | } 57 | layer { 58 | name: "relu1_2" 59 | type: "ReLU" 60 | bottom: "conv1_2" 61 | top: "conv1_2" 62 | } 63 | layer { 64 | name: "pool1" 65 | type: "Pooling" 66 | bottom: "conv1_2" 67 | top: "pool1" 68 | pooling_param { 69 | pool: MAX 70 | kernel_size: 2 71 | stride: 2 72 | } 73 | } 74 | layer { 75 | name: "conv2_1" 76 | type: "Convolution" 77 | bottom: "pool1" 78 | top: "conv2_1" 79 | param { 80 | lr_mult: 1 81 | decay_mult: 1 82 | } 83 | param { 84 | lr_mult: 2 85 | decay_mult: 0 86 | } 87 | convolution_param { 88 | num_output: 128 89 | pad: 1 90 | kernel_size: 3 91 | stride: 1 92 | } 93 | } 94 | layer { 95 | name: "relu2_1" 96 | type: "ReLU" 97 | bottom: "conv2_1" 98 | top: "conv2_1" 99 | } 100 | layer { 101 | name: "conv2_2" 102 | type: "Convolution" 103 | bottom: "conv2_1" 104 | top: "conv2_2" 105 | param { 106 | lr_mult: 1 107 | decay_mult: 1 108 | } 109 | param { 110 | lr_mult: 2 111 | decay_mult: 0 112 | } 113 | convolution_param { 114 | num_output: 128 115 | pad: 1 116 | kernel_size: 3 117 | stride: 1 118 | } 119 | } 120 | layer { 121 | name: "relu2_2" 122 | type: "ReLU" 123 | bottom: "conv2_2" 124 | top: "conv2_2" 125 | } 126 | layer { 127 | name: "pool2" 128 | type: "Pooling" 129 | bottom: "conv2_2" 130 | top: "pool2" 131 | pooling_param { 132 | pool: MAX 133 | kernel_size: 2 134 | stride: 2 135 | } 136 | } 137 | layer { 138 | name: "conv3_1" 139 | type: "Convolution" 140 | bottom: "pool2" 141 | top: "conv3_1" 142 | param { 143 | lr_mult: 1 144 | decay_mult: 1 145 | } 146 | param { 147 | lr_mult: 2 148 | decay_mult: 0 149 | } 150 | convolution_param { 151 | num_output: 256 152 | pad: 1 153 | kernel_size: 3 154 | stride: 1 155 | } 156 | } 157 | layer { 158 | name: "relu3_1" 159 | type: "ReLU" 160 | bottom: "conv3_1" 161 | top: "conv3_1" 162 | } 163 | layer { 164 | name: "conv3_2" 165 | type: "Convolution" 166 | bottom: "conv3_1" 167 | top: "conv3_2" 168 | param { 169 | lr_mult: 1 170 | decay_mult: 1 171 | } 172 | param { 173 | lr_mult: 2 174 | decay_mult: 0 175 | } 176 | convolution_param { 177 | num_output: 256 178 | pad: 1 179 | kernel_size: 3 180 | stride: 1 181 | } 182 | } 183 | layer { 184 | name: "relu3_2" 185 | type: "ReLU" 186 | bottom: "conv3_2" 187 | top: "conv3_2" 188 | } 189 | layer { 190 | name: "conv3_3" 191 | type: "Convolution" 192 | bottom: "conv3_2" 193 | top: "conv3_3" 194 | param { 195 | lr_mult: 1 196 | decay_mult: 1 197 | } 198 | param { 199 | lr_mult: 2 200 | decay_mult: 0 201 | } 202 | convolution_param { 203 | num_output: 256 204 | pad: 1 205 | kernel_size: 3 206 | stride: 1 207 | } 208 | } 209 | layer { 210 | name: "relu3_3" 211 | type: "ReLU" 212 | bottom: "conv3_3" 213 | top: "conv3_3" 214 | } 215 | layer { 216 | name: "pool3" 217 | type: "Pooling" 218 | bottom: "conv3_3" 219 | top: "pool3" 220 | pooling_param { 221 | pool: MAX 222 | kernel_size: 2 223 | stride: 2 224 | } 225 | } 226 | layer { 227 | name: "conv4_1" 228 | type: "Convolution" 229 | bottom: "pool3" 230 | top: "conv4_1" 231 | param { 232 | lr_mult: 1 233 | decay_mult: 1 234 | } 235 | param { 236 | lr_mult: 2 237 | decay_mult: 0 238 | } 239 | convolution_param { 240 | num_output: 512 241 | pad: 1 242 | kernel_size: 3 243 | stride: 1 244 | } 245 | } 246 | layer { 247 | name: "relu4_1" 248 | type: "ReLU" 249 | bottom: "conv4_1" 250 | top: "conv4_1" 251 | } 252 | layer { 253 | name: "conv4_2" 254 | type: "Convolution" 255 | bottom: "conv4_1" 256 | top: "conv4_2" 257 | param { 258 | lr_mult: 1 259 | decay_mult: 1 260 | } 261 | param { 262 | lr_mult: 2 263 | decay_mult: 0 264 | } 265 | convolution_param { 266 | num_output: 512 267 | pad: 1 268 | kernel_size: 3 269 | stride: 1 270 | } 271 | } 272 | layer { 273 | name: "relu4_2" 274 | type: "ReLU" 275 | bottom: "conv4_2" 276 | top: "conv4_2" 277 | } 278 | layer { 279 | name: "conv4_3" 280 | type: "Convolution" 281 | bottom: "conv4_2" 282 | top: "conv4_3" 283 | param { 284 | lr_mult: 1 285 | decay_mult: 1 286 | } 287 | param { 288 | lr_mult: 2 289 | decay_mult: 0 290 | } 291 | convolution_param { 292 | num_output: 512 293 | pad: 1 294 | kernel_size: 3 295 | stride: 1 296 | } 297 | } 298 | layer { 299 | name: "relu4_3" 300 | type: "ReLU" 301 | bottom: "conv4_3" 302 | top: "conv4_3" 303 | } 304 | layer { 305 | name: "pool4" 306 | type: "Pooling" 307 | bottom: "conv4_3" 308 | top: "pool4" 309 | pooling_param { 310 | pool: MAX 311 | kernel_size: 2 312 | stride: 2 313 | } 314 | } 315 | layer { 316 | name: "conv5_1" 317 | type: "Convolution" 318 | bottom: "pool4" 319 | top: "conv5_1" 320 | param { 321 | lr_mult: 1 322 | decay_mult: 1 323 | } 324 | param { 325 | lr_mult: 2 326 | decay_mult: 0 327 | } 328 | convolution_param { 329 | num_output: 512 330 | pad: 1 331 | kernel_size: 3 332 | stride: 1 333 | } 334 | } 335 | layer { 336 | name: "relu5_1" 337 | type: "ReLU" 338 | bottom: "conv5_1" 339 | top: "conv5_1" 340 | } 341 | layer { 342 | name: "conv5_2" 343 | type: "Convolution" 344 | bottom: "conv5_1" 345 | top: "conv5_2" 346 | param { 347 | lr_mult: 1 348 | decay_mult: 1 349 | } 350 | param { 351 | lr_mult: 2 352 | decay_mult: 0 353 | } 354 | convolution_param { 355 | num_output: 512 356 | pad: 1 357 | kernel_size: 3 358 | stride: 1 359 | } 360 | } 361 | layer { 362 | name: "relu5_2" 363 | type: "ReLU" 364 | bottom: "conv5_2" 365 | top: "conv5_2" 366 | } 367 | layer { 368 | name: "conv5_3" 369 | type: "Convolution" 370 | bottom: "conv5_2" 371 | top: "conv5_3" 372 | param { 373 | lr_mult: 1 374 | decay_mult: 1 375 | } 376 | param { 377 | lr_mult: 2 378 | decay_mult: 0 379 | } 380 | convolution_param { 381 | num_output: 512 382 | pad: 1 383 | kernel_size: 3 384 | stride: 1 385 | } 386 | } 387 | layer { 388 | name: "relu5_3" 389 | type: "ReLU" 390 | bottom: "conv5_3" 391 | top: "conv5_3" 392 | } 393 | layer { 394 | name: "pool5" 395 | type: "Pooling" 396 | bottom: "conv5_3" 397 | top: "pool5" 398 | pooling_param { 399 | pool: MAX 400 | kernel_size: 2 401 | stride: 2 402 | } 403 | } 404 | layer { 405 | name: "fc6" 406 | type: "Convolution" 407 | bottom: "pool5" 408 | top: "fc6" 409 | param { 410 | lr_mult: 1 411 | decay_mult: 1 412 | } 413 | param { 414 | lr_mult: 2 415 | decay_mult: 0 416 | } 417 | convolution_param { 418 | num_output: 4096 419 | pad: 0 420 | kernel_size: 7 421 | stride: 1 422 | } 423 | } 424 | layer { 425 | name: "relu6" 426 | type: "ReLU" 427 | bottom: "fc6" 428 | top: "fc6" 429 | } 430 | layer { 431 | name: "fc7" 432 | type: "Convolution" 433 | bottom: "fc6" 434 | top: "fc7" 435 | param { 436 | lr_mult: 1 437 | decay_mult: 1 438 | } 439 | param { 440 | lr_mult: 2 441 | decay_mult: 0 442 | } 443 | convolution_param { 444 | num_output: 4096 445 | pad: 0 446 | kernel_size: 1 447 | stride: 1 448 | } 449 | } 450 | layer { 451 | name: "relu7" 452 | type: "ReLU" 453 | bottom: "fc7" 454 | top: "fc7" 455 | } 456 | layer { 457 | name: "score_fr" 458 | type: "Convolution" 459 | bottom: "fc7" 460 | top: "score_fr" 461 | param { 462 | lr_mult: 1 463 | decay_mult: 1 464 | } 465 | param { 466 | lr_mult: 2 467 | decay_mult: 0 468 | } 469 | convolution_param { 470 | num_output: 21 471 | pad: 0 472 | kernel_size: 1 473 | } 474 | } 475 | layer { 476 | name: "upscore" 477 | type: "Deconvolution" 478 | bottom: "score_fr" 479 | top: "upscore" 480 | param { 481 | lr_mult: 0 482 | } 483 | convolution_param { 484 | num_output: 21 485 | bias_term: false 486 | kernel_size: 64 487 | stride: 32 488 | } 489 | } 490 | layer { 491 | name: "score" 492 | type: "Crop" 493 | bottom: "upscore" 494 | bottom: "data" 495 | top: "score" 496 | crop_param { 497 | axis: 2 498 | offset: 19 499 | } 500 | } 501 | -------------------------------------------------------------------------------- /fcn/rgb_voc_fcn32s/net.py: -------------------------------------------------------------------------------- 1 | import caffe 2 | from caffe import layers as L, params as P 3 | from caffe.coord_map import crop 4 | 5 | def conv_relu(bottom, nout, ks=3, stride=1, pad=1): 6 | conv = L.Convolution(bottom, kernel_size=ks, stride=stride, 7 | num_output=nout, pad=pad, 8 | param=[dict(lr_mult=1, decay_mult=1), dict(lr_mult=2, decay_mult=0)]) 9 | return conv, L.ReLU(conv, in_place=True) 10 | 11 | def max_pool(bottom, ks=2, stride=2): 12 | return L.Pooling(bottom, pool=P.Pooling.MAX, kernel_size=ks, stride=stride) 13 | 14 | def fcn(split): 15 | n = caffe.NetSpec() 16 | pydata_params = dict(split=split, mean=(104.00699, 116.66877, 122.67892), 17 | seed=1337) 18 | if split == 'train': 19 | pydata_params['sbdd_dir'] = '../../data/sbdd/dataset' 20 | pylayer = 'SBDDSegDataLayer' 21 | else: 22 | pydata_params['voc_dir'] = '../../data/pascal/VOC2011' 23 | pylayer = 'VOCSegDataLayer' 24 | n.data, n.label = L.Python(module='voc_layers', layer=pylayer, 25 | ntop=2, param_str=str(pydata_params)) 26 | 27 | # the base net 28 | n.conv1_1, n.relu1_1 = conv_relu(n.data, 64, pad=100) 29 | n.conv1_2, n.relu1_2 = conv_relu(n.relu1_1, 64) 30 | n.pool1 = max_pool(n.relu1_2) 31 | 32 | n.conv2_1, n.relu2_1 = conv_relu(n.pool1, 128) 33 | n.conv2_2, n.relu2_2 = conv_relu(n.relu2_1, 128) 34 | n.pool2 = max_pool(n.relu2_2) 35 | 36 | n.conv3_1, n.relu3_1 = conv_relu(n.pool2, 256) 37 | n.conv3_2, n.relu3_2 = conv_relu(n.relu3_1, 256) 38 | n.conv3_3, n.relu3_3 = conv_relu(n.relu3_2, 256) 39 | n.pool3 = max_pool(n.relu3_3) 40 | 41 | n.conv4_1, n.relu4_1 = conv_relu(n.pool3, 512) 42 | n.conv4_2, n.relu4_2 = conv_relu(n.relu4_1, 512) 43 | n.conv4_3, n.relu4_3 = conv_relu(n.relu4_2, 512) 44 | n.pool4 = max_pool(n.relu4_3) 45 | 46 | n.conv5_1, n.relu5_1 = conv_relu(n.pool4, 512) 47 | n.conv5_2, n.relu5_2 = conv_relu(n.relu5_1, 512) 48 | n.conv5_3, n.relu5_3 = conv_relu(n.relu5_2, 512) 49 | n.pool5 = max_pool(n.relu5_3) 50 | 51 | # fully conv 52 | n.fc6, n.relu6 = conv_relu(n.pool5, 4096, ks=7, pad=0) 53 | n.drop6 = L.Dropout(n.relu6, dropout_ratio=0.5, in_place=True) 54 | n.fc7, n.relu7 = conv_relu(n.drop6, 4096, ks=1, pad=0) 55 | n.drop7 = L.Dropout(n.relu7, dropout_ratio=0.5, in_place=True) 56 | n.score_fr = L.Convolution(n.drop7, num_output=21, kernel_size=1, pad=0, 57 | param=[dict(lr_mult=1, decay_mult=1), dict(lr_mult=2, decay_mult=0)]) 58 | n.upscore = L.Deconvolution(n.score_fr, 59 | convolution_param=dict(num_output=21, kernel_size=64, stride=32, 60 | bias_term=False), 61 | param=[dict(lr_mult=0)]) 62 | n.score = crop(n.upscore, n.data) 63 | n.loss = L.SoftmaxWithLoss(n.score, n.label, 64 | loss_param=dict(normalize=False, ignore_label=255)) 65 | 66 | return n.to_proto() 67 | 68 | def make_net(): 69 | with open('blubble_t.prototxt', 'w') as f: 70 | f.write(str(fcn('train'))) 71 | 72 | with open('blubble_v.prototxt', 'w') as f: 73 | f.write(str(fcn('seg11valid'))) 74 | 75 | if __name__ == '__main__': 76 | make_net() 77 | -------------------------------------------------------------------------------- /fcn/rgb_voc_fcn32s/solve.py: -------------------------------------------------------------------------------- 1 | import caffe 2 | import surgery, score 3 | 4 | import numpy as np 5 | import os 6 | 7 | import setproctitle 8 | setproctitle.setproctitle(os.path.basename(os.getcwd())) 9 | 10 | weights = 'rgb_voc_fcn32s/train_iter_96000.caffemodel' 11 | 12 | # init 13 | caffe.set_device(0) 14 | caffe.set_mode_gpu() 15 | 16 | solver = caffe.SGDSolver('rgb_voc_fcn32s/solver.prototxt') 17 | solver.net.copy_from(weights) 18 | 19 | # surgeries 20 | interp_layers = [k for k in solver.net.params.keys() if 'up' in k] 21 | surgery.interp(solver.net, interp_layers) 22 | 23 | # scoring 24 | val = np.loadtxt('data/rgb_voc/segvalid.txt', dtype=str) 25 | 26 | # Skip the loop (commented out below) 27 | solver.step(4000) 28 | score.seg_tests(solver, False, val, layer='my_score') 29 | 30 | # for _ in range(25): 31 | # solver.step(4000) 32 | # score.seg_tests(solver, False, val, layer='my_score') 33 | -------------------------------------------------------------------------------- /fcn/rgb_voc_fcn32s/solver.prototxt: -------------------------------------------------------------------------------- 1 | train_net: "rgb_voc_fcn32s/train.prototxt" 2 | test_net: "rgb_voc_fcn32s/val.prototxt" 3 | test_iter: 736 4 | # make test net, but don't invoke it from the solver itself 5 | test_interval: 999999999 6 | display: 20 7 | average_loss: 20 8 | lr_policy: "fixed" 9 | # lr for unnormalized softmax 10 | base_lr: 1e-10 11 | # high momentum 12 | momentum: 0.99 13 | # no gradient accumulation 14 | iter_size: 1 15 | max_iter: 100000 16 | weight_decay: 0.0005 17 | snapshot: 4000 18 | snapshot_prefix: "snapshot/train" 19 | test_initialization: false 20 | -------------------------------------------------------------------------------- /fcn/rgb_voc_fcn32s/train.prototxt: -------------------------------------------------------------------------------- 1 | layer { 2 | name: "data" 3 | type: "Python" 4 | top: "data" 5 | top: "label" 6 | python_param { 7 | module: "rgb_voc_layers" 8 | layer: "rgbDataLayer" 9 | param_str: "{\'input_file\': \'data/rgb_voc/train.txt\', \'seed\': 1337, \'split\': \'train\', \'mean\': (104.00699, 116.66877, 122.67892)}" 10 | } 11 | } 12 | layer { 13 | name: "conv1_1" 14 | type: "Convolution" 15 | bottom: "data" 16 | top: "conv1_1" 17 | param { 18 | lr_mult: 1 19 | decay_mult: 1 20 | } 21 | param { 22 | lr_mult: 2 23 | decay_mult: 0 24 | } 25 | convolution_param { 26 | num_output: 64 27 | pad: 100 28 | kernel_size: 3 29 | stride: 1 30 | } 31 | } 32 | layer { 33 | name: "relu1_1" 34 | type: "ReLU" 35 | bottom: "conv1_1" 36 | top: "conv1_1" 37 | } 38 | layer { 39 | name: "conv1_2" 40 | type: "Convolution" 41 | bottom: "conv1_1" 42 | top: "conv1_2" 43 | param { 44 | lr_mult: 1 45 | decay_mult: 1 46 | } 47 | param { 48 | lr_mult: 2 49 | decay_mult: 0 50 | } 51 | convolution_param { 52 | num_output: 64 53 | pad: 1 54 | kernel_size: 3 55 | stride: 1 56 | } 57 | } 58 | layer { 59 | name: "relu1_2" 60 | type: "ReLU" 61 | bottom: "conv1_2" 62 | top: "conv1_2" 63 | } 64 | layer { 65 | name: "pool1" 66 | type: "Pooling" 67 | bottom: "conv1_2" 68 | top: "pool1" 69 | pooling_param { 70 | pool: MAX 71 | kernel_size: 2 72 | stride: 2 73 | } 74 | } 75 | layer { 76 | name: "conv2_1" 77 | type: "Convolution" 78 | bottom: "pool1" 79 | top: "conv2_1" 80 | param { 81 | lr_mult: 1 82 | decay_mult: 1 83 | } 84 | param { 85 | lr_mult: 2 86 | decay_mult: 0 87 | } 88 | convolution_param { 89 | num_output: 128 90 | pad: 1 91 | kernel_size: 3 92 | stride: 1 93 | } 94 | } 95 | layer { 96 | name: "relu2_1" 97 | type: "ReLU" 98 | bottom: "conv2_1" 99 | top: "conv2_1" 100 | } 101 | layer { 102 | name: "conv2_2" 103 | type: "Convolution" 104 | bottom: "conv2_1" 105 | top: "conv2_2" 106 | param { 107 | lr_mult: 1 108 | decay_mult: 1 109 | } 110 | param { 111 | lr_mult: 2 112 | decay_mult: 0 113 | } 114 | convolution_param { 115 | num_output: 128 116 | pad: 1 117 | kernel_size: 3 118 | stride: 1 119 | } 120 | } 121 | layer { 122 | name: "relu2_2" 123 | type: "ReLU" 124 | bottom: "conv2_2" 125 | top: "conv2_2" 126 | } 127 | layer { 128 | name: "pool2" 129 | type: "Pooling" 130 | bottom: "conv2_2" 131 | top: "pool2" 132 | pooling_param { 133 | pool: MAX 134 | kernel_size: 2 135 | stride: 2 136 | } 137 | } 138 | layer { 139 | name: "conv3_1" 140 | type: "Convolution" 141 | bottom: "pool2" 142 | top: "conv3_1" 143 | param { 144 | lr_mult: 1 145 | decay_mult: 1 146 | } 147 | param { 148 | lr_mult: 2 149 | decay_mult: 0 150 | } 151 | convolution_param { 152 | num_output: 256 153 | pad: 1 154 | kernel_size: 3 155 | stride: 1 156 | } 157 | } 158 | layer { 159 | name: "relu3_1" 160 | type: "ReLU" 161 | bottom: "conv3_1" 162 | top: "conv3_1" 163 | } 164 | layer { 165 | name: "conv3_2" 166 | type: "Convolution" 167 | bottom: "conv3_1" 168 | top: "conv3_2" 169 | param { 170 | lr_mult: 1 171 | decay_mult: 1 172 | } 173 | param { 174 | lr_mult: 2 175 | decay_mult: 0 176 | } 177 | convolution_param { 178 | num_output: 256 179 | pad: 1 180 | kernel_size: 3 181 | stride: 1 182 | } 183 | } 184 | layer { 185 | name: "relu3_2" 186 | type: "ReLU" 187 | bottom: "conv3_2" 188 | top: "conv3_2" 189 | } 190 | layer { 191 | name: "conv3_3" 192 | type: "Convolution" 193 | bottom: "conv3_2" 194 | top: "conv3_3" 195 | param { 196 | lr_mult: 1 197 | decay_mult: 1 198 | } 199 | param { 200 | lr_mult: 2 201 | decay_mult: 0 202 | } 203 | convolution_param { 204 | num_output: 256 205 | pad: 1 206 | kernel_size: 3 207 | stride: 1 208 | } 209 | } 210 | layer { 211 | name: "relu3_3" 212 | type: "ReLU" 213 | bottom: "conv3_3" 214 | top: "conv3_3" 215 | } 216 | layer { 217 | name: "pool3" 218 | type: "Pooling" 219 | bottom: "conv3_3" 220 | top: "pool3" 221 | pooling_param { 222 | pool: MAX 223 | kernel_size: 2 224 | stride: 2 225 | } 226 | } 227 | layer { 228 | name: "conv4_1" 229 | type: "Convolution" 230 | bottom: "pool3" 231 | top: "conv4_1" 232 | param { 233 | lr_mult: 1 234 | decay_mult: 1 235 | } 236 | param { 237 | lr_mult: 2 238 | decay_mult: 0 239 | } 240 | convolution_param { 241 | num_output: 512 242 | pad: 1 243 | kernel_size: 3 244 | stride: 1 245 | } 246 | } 247 | layer { 248 | name: "relu4_1" 249 | type: "ReLU" 250 | bottom: "conv4_1" 251 | top: "conv4_1" 252 | } 253 | layer { 254 | name: "conv4_2" 255 | type: "Convolution" 256 | bottom: "conv4_1" 257 | top: "conv4_2" 258 | param { 259 | lr_mult: 1 260 | decay_mult: 1 261 | } 262 | param { 263 | lr_mult: 2 264 | decay_mult: 0 265 | } 266 | convolution_param { 267 | num_output: 512 268 | pad: 1 269 | kernel_size: 3 270 | stride: 1 271 | } 272 | } 273 | layer { 274 | name: "relu4_2" 275 | type: "ReLU" 276 | bottom: "conv4_2" 277 | top: "conv4_2" 278 | } 279 | layer { 280 | name: "conv4_3" 281 | type: "Convolution" 282 | bottom: "conv4_2" 283 | top: "conv4_3" 284 | param { 285 | lr_mult: 1 286 | decay_mult: 1 287 | } 288 | param { 289 | lr_mult: 2 290 | decay_mult: 0 291 | } 292 | convolution_param { 293 | num_output: 512 294 | pad: 1 295 | kernel_size: 3 296 | stride: 1 297 | } 298 | } 299 | layer { 300 | name: "relu4_3" 301 | type: "ReLU" 302 | bottom: "conv4_3" 303 | top: "conv4_3" 304 | } 305 | layer { 306 | name: "pool4" 307 | type: "Pooling" 308 | bottom: "conv4_3" 309 | top: "pool4" 310 | pooling_param { 311 | pool: MAX 312 | kernel_size: 2 313 | stride: 2 314 | } 315 | } 316 | layer { 317 | name: "conv5_1" 318 | type: "Convolution" 319 | bottom: "pool4" 320 | top: "conv5_1" 321 | param { 322 | lr_mult: 1 323 | decay_mult: 1 324 | } 325 | param { 326 | lr_mult: 2 327 | decay_mult: 0 328 | } 329 | convolution_param { 330 | num_output: 512 331 | pad: 1 332 | kernel_size: 3 333 | stride: 1 334 | } 335 | } 336 | layer { 337 | name: "relu5_1" 338 | type: "ReLU" 339 | bottom: "conv5_1" 340 | top: "conv5_1" 341 | } 342 | layer { 343 | name: "conv5_2" 344 | type: "Convolution" 345 | bottom: "conv5_1" 346 | top: "conv5_2" 347 | param { 348 | lr_mult: 1 349 | decay_mult: 1 350 | } 351 | param { 352 | lr_mult: 2 353 | decay_mult: 0 354 | } 355 | convolution_param { 356 | num_output: 512 357 | pad: 1 358 | kernel_size: 3 359 | stride: 1 360 | } 361 | } 362 | layer { 363 | name: "relu5_2" 364 | type: "ReLU" 365 | bottom: "conv5_2" 366 | top: "conv5_2" 367 | } 368 | layer { 369 | name: "conv5_3" 370 | type: "Convolution" 371 | bottom: "conv5_2" 372 | top: "conv5_3" 373 | param { 374 | lr_mult: 1 375 | decay_mult: 1 376 | } 377 | param { 378 | lr_mult: 2 379 | decay_mult: 0 380 | } 381 | convolution_param { 382 | num_output: 512 383 | pad: 1 384 | kernel_size: 3 385 | stride: 1 386 | } 387 | } 388 | layer { 389 | name: "relu5_3" 390 | type: "ReLU" 391 | bottom: "conv5_3" 392 | top: "conv5_3" 393 | } 394 | layer { 395 | name: "pool5" 396 | type: "Pooling" 397 | bottom: "conv5_3" 398 | top: "pool5" 399 | pooling_param { 400 | pool: MAX 401 | kernel_size: 2 402 | stride: 2 403 | } 404 | } 405 | layer { 406 | name: "fc6" 407 | type: "Convolution" 408 | bottom: "pool5" 409 | top: "fc6" 410 | param { 411 | lr_mult: 1 412 | decay_mult: 1 413 | } 414 | param { 415 | lr_mult: 2 416 | decay_mult: 0 417 | } 418 | convolution_param { 419 | num_output: 4096 420 | pad: 0 421 | kernel_size: 7 422 | stride: 1 423 | } 424 | } 425 | layer { 426 | name: "relu6" 427 | type: "ReLU" 428 | bottom: "fc6" 429 | top: "fc6" 430 | } 431 | layer { 432 | name: "fc7" 433 | type: "Convolution" 434 | bottom: "fc6" 435 | top: "fc7" 436 | param { 437 | lr_mult: 1 438 | decay_mult: 1 439 | } 440 | param { 441 | lr_mult: 2 442 | decay_mult: 0 443 | } 444 | convolution_param { 445 | num_output: 4096 446 | pad: 0 447 | kernel_size: 1 448 | stride: 1 449 | } 450 | } 451 | layer { 452 | name: "relu7" 453 | type: "ReLU" 454 | bottom: "fc7" 455 | top: "fc7" 456 | } 457 | layer { 458 | name: "my_score_fr" 459 | type: "Convolution" 460 | bottom: "fc7" 461 | top: "my_score_fr" 462 | param { 463 | lr_mult: 1 464 | decay_mult: 1 465 | } 466 | param { 467 | lr_mult: 2 468 | decay_mult: 0 469 | } 470 | convolution_param { 471 | num_output: 20 472 | pad: 0 473 | kernel_size: 1 474 | } 475 | } 476 | layer { 477 | name: "my_upscore" 478 | type: "Deconvolution" 479 | bottom: "my_score_fr" 480 | top: "my_upscore" 481 | param { 482 | lr_mult: 0 483 | } 484 | convolution_param { 485 | num_output: 20 486 | bias_term: false 487 | kernel_size: 64 488 | stride: 32 489 | } 490 | } 491 | layer { 492 | name: "my_score" 493 | type: "Crop" 494 | bottom: "my_upscore" 495 | bottom: "data" 496 | top: "my_score" 497 | crop_param { 498 | axis: 2 499 | offset: 19 500 | } 501 | } 502 | layer { 503 | name: "my_loss" 504 | type: "SoftmaxWithLoss" 505 | bottom: "my_score" 506 | bottom: "label" 507 | top: "my_loss" 508 | loss_param { 509 | ignore_label: 255 510 | normalize: false 511 | } 512 | } 513 | -------------------------------------------------------------------------------- /fcn/rgb_voc_fcn32s/val.prototxt: -------------------------------------------------------------------------------- 1 | layer { 2 | name: "data" 3 | type: "Python" 4 | top: "data" 5 | top: "label" 6 | python_param { 7 | module: "rgb_voc_layers" 8 | layer: "rgbDataLayer" 9 | param_str: "{\'input_file\': \'data/rgb_voc/test.txt\', \'seed\': 1337, \'split\': \'seg11valid\', \'mean\': (104.00699, 116.66877, 122.67892)}" 10 | } 11 | } 12 | layer { 13 | name: "conv1_1" 14 | type: "Convolution" 15 | bottom: "data" 16 | top: "conv1_1" 17 | param { 18 | lr_mult: 1 19 | decay_mult: 1 20 | } 21 | param { 22 | lr_mult: 2 23 | decay_mult: 0 24 | } 25 | convolution_param { 26 | num_output: 64 27 | pad: 100 28 | kernel_size: 3 29 | stride: 1 30 | } 31 | } 32 | layer { 33 | name: "relu1_1" 34 | type: "ReLU" 35 | bottom: "conv1_1" 36 | top: "conv1_1" 37 | } 38 | layer { 39 | name: "conv1_2" 40 | type: "Convolution" 41 | bottom: "conv1_1" 42 | top: "conv1_2" 43 | param { 44 | lr_mult: 1 45 | decay_mult: 1 46 | } 47 | param { 48 | lr_mult: 2 49 | decay_mult: 0 50 | } 51 | convolution_param { 52 | num_output: 64 53 | pad: 1 54 | kernel_size: 3 55 | stride: 1 56 | } 57 | } 58 | layer { 59 | name: "relu1_2" 60 | type: "ReLU" 61 | bottom: "conv1_2" 62 | top: "conv1_2" 63 | } 64 | layer { 65 | name: "pool1" 66 | type: "Pooling" 67 | bottom: "conv1_2" 68 | top: "pool1" 69 | pooling_param { 70 | pool: MAX 71 | kernel_size: 2 72 | stride: 2 73 | } 74 | } 75 | layer { 76 | name: "conv2_1" 77 | type: "Convolution" 78 | bottom: "pool1" 79 | top: "conv2_1" 80 | param { 81 | lr_mult: 1 82 | decay_mult: 1 83 | } 84 | param { 85 | lr_mult: 2 86 | decay_mult: 0 87 | } 88 | convolution_param { 89 | num_output: 128 90 | pad: 1 91 | kernel_size: 3 92 | stride: 1 93 | } 94 | } 95 | layer { 96 | name: "relu2_1" 97 | type: "ReLU" 98 | bottom: "conv2_1" 99 | top: "conv2_1" 100 | } 101 | layer { 102 | name: "conv2_2" 103 | type: "Convolution" 104 | bottom: "conv2_1" 105 | top: "conv2_2" 106 | param { 107 | lr_mult: 1 108 | decay_mult: 1 109 | } 110 | param { 111 | lr_mult: 2 112 | decay_mult: 0 113 | } 114 | convolution_param { 115 | num_output: 128 116 | pad: 1 117 | kernel_size: 3 118 | stride: 1 119 | } 120 | } 121 | layer { 122 | name: "relu2_2" 123 | type: "ReLU" 124 | bottom: "conv2_2" 125 | top: "conv2_2" 126 | } 127 | layer { 128 | name: "pool2" 129 | type: "Pooling" 130 | bottom: "conv2_2" 131 | top: "pool2" 132 | pooling_param { 133 | pool: MAX 134 | kernel_size: 2 135 | stride: 2 136 | } 137 | } 138 | layer { 139 | name: "conv3_1" 140 | type: "Convolution" 141 | bottom: "pool2" 142 | top: "conv3_1" 143 | param { 144 | lr_mult: 1 145 | decay_mult: 1 146 | } 147 | param { 148 | lr_mult: 2 149 | decay_mult: 0 150 | } 151 | convolution_param { 152 | num_output: 256 153 | pad: 1 154 | kernel_size: 3 155 | stride: 1 156 | } 157 | } 158 | layer { 159 | name: "relu3_1" 160 | type: "ReLU" 161 | bottom: "conv3_1" 162 | top: "conv3_1" 163 | } 164 | layer { 165 | name: "conv3_2" 166 | type: "Convolution" 167 | bottom: "conv3_1" 168 | top: "conv3_2" 169 | param { 170 | lr_mult: 1 171 | decay_mult: 1 172 | } 173 | param { 174 | lr_mult: 2 175 | decay_mult: 0 176 | } 177 | convolution_param { 178 | num_output: 256 179 | pad: 1 180 | kernel_size: 3 181 | stride: 1 182 | } 183 | } 184 | layer { 185 | name: "relu3_2" 186 | type: "ReLU" 187 | bottom: "conv3_2" 188 | top: "conv3_2" 189 | } 190 | layer { 191 | name: "conv3_3" 192 | type: "Convolution" 193 | bottom: "conv3_2" 194 | top: "conv3_3" 195 | param { 196 | lr_mult: 1 197 | decay_mult: 1 198 | } 199 | param { 200 | lr_mult: 2 201 | decay_mult: 0 202 | } 203 | convolution_param { 204 | num_output: 256 205 | pad: 1 206 | kernel_size: 3 207 | stride: 1 208 | } 209 | } 210 | layer { 211 | name: "relu3_3" 212 | type: "ReLU" 213 | bottom: "conv3_3" 214 | top: "conv3_3" 215 | } 216 | layer { 217 | name: "pool3" 218 | type: "Pooling" 219 | bottom: "conv3_3" 220 | top: "pool3" 221 | pooling_param { 222 | pool: MAX 223 | kernel_size: 2 224 | stride: 2 225 | } 226 | } 227 | layer { 228 | name: "conv4_1" 229 | type: "Convolution" 230 | bottom: "pool3" 231 | top: "conv4_1" 232 | param { 233 | lr_mult: 1 234 | decay_mult: 1 235 | } 236 | param { 237 | lr_mult: 2 238 | decay_mult: 0 239 | } 240 | convolution_param { 241 | num_output: 512 242 | pad: 1 243 | kernel_size: 3 244 | stride: 1 245 | } 246 | } 247 | layer { 248 | name: "relu4_1" 249 | type: "ReLU" 250 | bottom: "conv4_1" 251 | top: "conv4_1" 252 | } 253 | layer { 254 | name: "conv4_2" 255 | type: "Convolution" 256 | bottom: "conv4_1" 257 | top: "conv4_2" 258 | param { 259 | lr_mult: 1 260 | decay_mult: 1 261 | } 262 | param { 263 | lr_mult: 2 264 | decay_mult: 0 265 | } 266 | convolution_param { 267 | num_output: 512 268 | pad: 1 269 | kernel_size: 3 270 | stride: 1 271 | } 272 | } 273 | layer { 274 | name: "relu4_2" 275 | type: "ReLU" 276 | bottom: "conv4_2" 277 | top: "conv4_2" 278 | } 279 | layer { 280 | name: "conv4_3" 281 | type: "Convolution" 282 | bottom: "conv4_2" 283 | top: "conv4_3" 284 | param { 285 | lr_mult: 1 286 | decay_mult: 1 287 | } 288 | param { 289 | lr_mult: 2 290 | decay_mult: 0 291 | } 292 | convolution_param { 293 | num_output: 512 294 | pad: 1 295 | kernel_size: 3 296 | stride: 1 297 | } 298 | } 299 | layer { 300 | name: "relu4_3" 301 | type: "ReLU" 302 | bottom: "conv4_3" 303 | top: "conv4_3" 304 | } 305 | layer { 306 | name: "pool4" 307 | type: "Pooling" 308 | bottom: "conv4_3" 309 | top: "pool4" 310 | pooling_param { 311 | pool: MAX 312 | kernel_size: 2 313 | stride: 2 314 | } 315 | } 316 | layer { 317 | name: "conv5_1" 318 | type: "Convolution" 319 | bottom: "pool4" 320 | top: "conv5_1" 321 | param { 322 | lr_mult: 1 323 | decay_mult: 1 324 | } 325 | param { 326 | lr_mult: 2 327 | decay_mult: 0 328 | } 329 | convolution_param { 330 | num_output: 512 331 | pad: 1 332 | kernel_size: 3 333 | stride: 1 334 | } 335 | } 336 | layer { 337 | name: "relu5_1" 338 | type: "ReLU" 339 | bottom: "conv5_1" 340 | top: "conv5_1" 341 | } 342 | layer { 343 | name: "conv5_2" 344 | type: "Convolution" 345 | bottom: "conv5_1" 346 | top: "conv5_2" 347 | param { 348 | lr_mult: 1 349 | decay_mult: 1 350 | } 351 | param { 352 | lr_mult: 2 353 | decay_mult: 0 354 | } 355 | convolution_param { 356 | num_output: 512 357 | pad: 1 358 | kernel_size: 3 359 | stride: 1 360 | } 361 | } 362 | layer { 363 | name: "relu5_2" 364 | type: "ReLU" 365 | bottom: "conv5_2" 366 | top: "conv5_2" 367 | } 368 | layer { 369 | name: "conv5_3" 370 | type: "Convolution" 371 | bottom: "conv5_2" 372 | top: "conv5_3" 373 | param { 374 | lr_mult: 1 375 | decay_mult: 1 376 | } 377 | param { 378 | lr_mult: 2 379 | decay_mult: 0 380 | } 381 | convolution_param { 382 | num_output: 512 383 | pad: 1 384 | kernel_size: 3 385 | stride: 1 386 | } 387 | } 388 | layer { 389 | name: "relu5_3" 390 | type: "ReLU" 391 | bottom: "conv5_3" 392 | top: "conv5_3" 393 | } 394 | layer { 395 | name: "pool5" 396 | type: "Pooling" 397 | bottom: "conv5_3" 398 | top: "pool5" 399 | pooling_param { 400 | pool: MAX 401 | kernel_size: 2 402 | stride: 2 403 | } 404 | } 405 | layer { 406 | name: "fc6" 407 | type: "Convolution" 408 | bottom: "pool5" 409 | top: "fc6" 410 | param { 411 | lr_mult: 1 412 | decay_mult: 1 413 | } 414 | param { 415 | lr_mult: 2 416 | decay_mult: 0 417 | } 418 | convolution_param { 419 | num_output: 4096 420 | pad: 0 421 | kernel_size: 7 422 | stride: 1 423 | } 424 | } 425 | layer { 426 | name: "relu6" 427 | type: "ReLU" 428 | bottom: "fc6" 429 | top: "fc6" 430 | } 431 | layer { 432 | name: "fc7" 433 | type: "Convolution" 434 | bottom: "fc6" 435 | top: "fc7" 436 | param { 437 | lr_mult: 1 438 | decay_mult: 1 439 | } 440 | param { 441 | lr_mult: 2 442 | decay_mult: 0 443 | } 444 | convolution_param { 445 | num_output: 4096 446 | pad: 0 447 | kernel_size: 1 448 | stride: 1 449 | } 450 | } 451 | layer { 452 | name: "relu7" 453 | type: "ReLU" 454 | bottom: "fc7" 455 | top: "fc7" 456 | } 457 | layer { 458 | name: "my_score_fr" 459 | type: "Convolution" 460 | bottom: "fc7" 461 | top: "my_score_fr" 462 | param { 463 | lr_mult: 1 464 | decay_mult: 1 465 | } 466 | param { 467 | lr_mult: 2 468 | decay_mult: 0 469 | } 470 | convolution_param { 471 | num_output: 20 472 | pad: 0 473 | kernel_size: 1 474 | } 475 | } 476 | layer { 477 | name: "my_upscore" 478 | type: "Deconvolution" 479 | bottom: "my_score_fr" 480 | top: "my_upscore" 481 | param { 482 | lr_mult: 0 483 | } 484 | convolution_param { 485 | num_output: 20 486 | bias_term: false 487 | kernel_size: 64 488 | stride: 32 489 | } 490 | } 491 | layer { 492 | name: "my_score" 493 | type: "Crop" 494 | bottom: "my_upscore" 495 | bottom: "data" 496 | top: "my_score" 497 | crop_param { 498 | axis: 2 499 | offset: 19 500 | } 501 | } 502 | layer { 503 | name: "my_loss" 504 | type: "SoftmaxWithLoss" 505 | bottom: "my_score" 506 | bottom: "label" 507 | top: "my_loss" 508 | loss_param { 509 | ignore_label: 255 510 | normalize: false 511 | } 512 | } 513 | -------------------------------------------------------------------------------- /fcn/rgb_voc_layers.py: -------------------------------------------------------------------------------- 1 | import caffe 2 | 3 | import numpy as np 4 | from PIL import Image 5 | 6 | import random 7 | 8 | class rgbDataLayer(caffe.Layer): 9 | """ 10 | Load (input image, label image) pairs from PASCAL VOC 11 | one-at-a-time while reshaping the net to preserve dimensions. 12 | 13 | Use this to feed data to a fully convolutional network. 14 | """ 15 | 16 | def setup(self, bottom, top): 17 | """ 18 | Setup data layer according to parameters: 19 | 20 | - test_file; list of test images and labels 21 | - train_file; list of test images and labels 22 | - split: train / val / test 23 | - mean: tuple of mean values to subtract 24 | - randomize: load in random order (default: True) 25 | - seed: seed for randomization (default: None / current time) 26 | 27 | for PASCAL VOC semantic segmentation. 28 | 29 | example 30 | 31 | params = dict(voc_dir="/path/to/PASCAL/VOC2011", 32 | mean=(104.00698793, 116.66876762, 122.67891434), 33 | split="val") 34 | """ 35 | # config 36 | params = eval(self.param_str) 37 | self.input_file = params['input_file'] 38 | self.split = params['split'] 39 | self.mean = np.array(params['mean']) 40 | # self.random = params.get('randomize', True) 41 | self.random = False 42 | self.seed = params.get('seed', None) 43 | 44 | # two tops: data and label 45 | if len(top) != 2: 46 | raise Exception("Need to define two tops: data and label.") 47 | # data layers have no bottoms 48 | if len(bottom) != 0: 49 | raise Exception("Do not define a bottom.") 50 | 51 | # load lines for images and labels 52 | self.lines = open(self.input_file, 'r').read().splitlines() 53 | self.idx = 0 54 | 55 | # make eval deterministic 56 | if 'train' not in self.split: 57 | self.random = False 58 | 59 | # randomization: seed and pick 60 | if self.random: 61 | random.seed(self.seed) 62 | self.idx = random.randint(0, len(self.lines)-1) 63 | 64 | 65 | def reshape(self, bottom, top): 66 | # load image + label image pair 67 | image_name, label_name = self.lines[self.idx].split(" ") 68 | # print "loading", image_name, label_name 69 | self.data = self.load_image(image_name) 70 | self.label = self.load_label(label_name) 71 | # reshape tops to fit (leading 1 is for batch dimension) 72 | top[0].reshape(1, *self.data.shape) 73 | top[1].reshape(1, *self.label.shape) 74 | 75 | 76 | def forward(self, bottom, top): 77 | # assign output 78 | top[0].data[...] = self.data 79 | top[1].data[...] = self.label 80 | 81 | # pick next input 82 | if self.random: 83 | self.idx = random.randint(0, len(self.lines)-1) 84 | else: 85 | self.idx += 1 86 | if self.idx == len(self.lines): 87 | self.idx = 0 88 | 89 | 90 | def backward(self, top, propagate_down, bottom): 91 | pass 92 | 93 | 94 | def load_image(self, image_name): 95 | """ 96 | Load input image and preprocess for Caffe: 97 | - cast to float 98 | - switch channels RGB -> BGR 99 | - subtract mean 100 | - transpose to channel x height x width order 101 | """ 102 | im = Image.open(image_name) 103 | in_ = np.array(im, dtype=np.float32) 104 | in_ = in_[:,:,::-1] 105 | in_ -= self.mean 106 | in_ = in_.transpose((2,0,1)) 107 | return in_ 108 | 109 | 110 | def load_label(self, label_name): 111 | """ 112 | Load label image as 1 x height x width integer array of label indices. 113 | The leading singleton dimension is required by the loss. 114 | """ 115 | im = Image.open(label_name) 116 | label = np.array(im, dtype=np.uint8) 117 | label = label[np.newaxis, ...] 118 | return label 119 | -------------------------------------------------------------------------------- /fcn/tbatch_infer.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Stays active, processing files in inbound 3 | # Shuffles files from inbound to classifed as they are processed by the net 4 | 5 | import sys 6 | import time 7 | import os 8 | 9 | import numpy as np 10 | from PIL import Image 11 | 12 | import caffe 13 | 14 | def process_file(net, arg, inbound, classified): 15 | src = os.path.join(inbound, arg) 16 | dest = os.path.join(classified, arg) 17 | # load image, switch to BGR, subtract mean, and make dims C x H x W for Caffe 18 | 19 | try: 20 | im = Image.open(os.path.join(inbound, arg)) 21 | in_ = np.array(im, dtype=np.float32) 22 | except IOError: 23 | print "IOError on:", src 24 | os.remove(src); 25 | return 26 | except SystemError: 27 | print "SystemError on:", src 28 | os.remove(src); 29 | return 30 | 31 | in_ = in_[:,:,::-1] 32 | in_ -= np.array((104.00698793,116.66876762,122.67891434)) 33 | in_ = in_.transpose((2,0,1)) 34 | 35 | # shape for input (data blob is N x C x H x W), set data 36 | net.blobs['data'].reshape(1, *in_.shape) 37 | net.blobs['data'].data[...] = in_ 38 | 39 | # run net and take argmax for prediction 40 | tic = time.clock() 41 | net.forward() 42 | toc = time.clock() 43 | print "time:", toc-tic 44 | 45 | # out = net.blobs['score'].data[0].argmax(axis=0) 46 | out = net.blobs['my_score'].data[0].argmax(axis=0) 47 | out_8 = np.empty_like(out, dtype=np.uint8) 48 | np.copyto(out_8, out, casting='unsafe') 49 | img = Image.fromarray(out_8) 50 | 51 | fn, ext = os.path.splitext(dest) 52 | if ext == ".jpg": 53 | img.save(fn + ".png") 54 | os.rename(src, dest) 55 | print arg, fn + ".png" 56 | else: 57 | print "Was expecting a jpg!", arg 58 | 59 | if __name__ == "__main__": 60 | caffe.set_mode_gpu() 61 | 62 | # load net 63 | net = caffe.Net('voc-fcn32s/deploy.prototxt', 'voc-fcn32s/fcn32s-heavy-pascal.caffemodel', caffe.TEST) 64 | 65 | inbound = "/caffe/inbound" 66 | classified = "/caffe/classified" 67 | while True: 68 | to_process = os.listdir(inbound) 69 | if to_process == []: 70 | # seem to have to keep it warm or we get timeouts 71 | net.forward() 72 | else: 73 | to_process.sort() 74 | for arg in to_process: 75 | print "Processing:", arg 76 | process_file(net, arg, inbound, classified) 77 | -------------------------------------------------------------------------------- /fcn/voc-fcn32s/deploy.prototxt: -------------------------------------------------------------------------------- 1 | layer { 2 | name: "input" 3 | type: "Input" 4 | top: "data" 5 | input_param { 6 | # These dimensions are purely for sake of example; 7 | # see infer.py for how to reshape the net to the given input size. 8 | shape { dim: 1 dim: 3 dim: 500 dim: 500 } 9 | } 10 | } 11 | layer { 12 | name: "conv1_1" 13 | type: "Convolution" 14 | bottom: "data" 15 | top: "conv1_1" 16 | param { 17 | lr_mult: 1 18 | decay_mult: 1 19 | } 20 | param { 21 | lr_mult: 2 22 | decay_mult: 0 23 | } 24 | convolution_param { 25 | num_output: 64 26 | pad: 100 27 | kernel_size: 3 28 | stride: 1 29 | } 30 | } 31 | layer { 32 | name: "relu1_1" 33 | type: "ReLU" 34 | bottom: "conv1_1" 35 | top: "conv1_1" 36 | } 37 | layer { 38 | name: "conv1_2" 39 | type: "Convolution" 40 | bottom: "conv1_1" 41 | top: "conv1_2" 42 | param { 43 | lr_mult: 1 44 | decay_mult: 1 45 | } 46 | param { 47 | lr_mult: 2 48 | decay_mult: 0 49 | } 50 | convolution_param { 51 | num_output: 64 52 | pad: 1 53 | kernel_size: 3 54 | stride: 1 55 | } 56 | } 57 | layer { 58 | name: "relu1_2" 59 | type: "ReLU" 60 | bottom: "conv1_2" 61 | top: "conv1_2" 62 | } 63 | layer { 64 | name: "pool1" 65 | type: "Pooling" 66 | bottom: "conv1_2" 67 | top: "pool1" 68 | pooling_param { 69 | pool: MAX 70 | kernel_size: 2 71 | stride: 2 72 | } 73 | } 74 | layer { 75 | name: "conv2_1" 76 | type: "Convolution" 77 | bottom: "pool1" 78 | top: "conv2_1" 79 | param { 80 | lr_mult: 1 81 | decay_mult: 1 82 | } 83 | param { 84 | lr_mult: 2 85 | decay_mult: 0 86 | } 87 | convolution_param { 88 | num_output: 128 89 | pad: 1 90 | kernel_size: 3 91 | stride: 1 92 | } 93 | } 94 | layer { 95 | name: "relu2_1" 96 | type: "ReLU" 97 | bottom: "conv2_1" 98 | top: "conv2_1" 99 | } 100 | layer { 101 | name: "conv2_2" 102 | type: "Convolution" 103 | bottom: "conv2_1" 104 | top: "conv2_2" 105 | param { 106 | lr_mult: 1 107 | decay_mult: 1 108 | } 109 | param { 110 | lr_mult: 2 111 | decay_mult: 0 112 | } 113 | convolution_param { 114 | num_output: 128 115 | pad: 1 116 | kernel_size: 3 117 | stride: 1 118 | } 119 | } 120 | layer { 121 | name: "relu2_2" 122 | type: "ReLU" 123 | bottom: "conv2_2" 124 | top: "conv2_2" 125 | } 126 | layer { 127 | name: "pool2" 128 | type: "Pooling" 129 | bottom: "conv2_2" 130 | top: "pool2" 131 | pooling_param { 132 | pool: MAX 133 | kernel_size: 2 134 | stride: 2 135 | } 136 | } 137 | layer { 138 | name: "conv3_1" 139 | type: "Convolution" 140 | bottom: "pool2" 141 | top: "conv3_1" 142 | param { 143 | lr_mult: 1 144 | decay_mult: 1 145 | } 146 | param { 147 | lr_mult: 2 148 | decay_mult: 0 149 | } 150 | convolution_param { 151 | num_output: 256 152 | pad: 1 153 | kernel_size: 3 154 | stride: 1 155 | } 156 | } 157 | layer { 158 | name: "relu3_1" 159 | type: "ReLU" 160 | bottom: "conv3_1" 161 | top: "conv3_1" 162 | } 163 | layer { 164 | name: "conv3_2" 165 | type: "Convolution" 166 | bottom: "conv3_1" 167 | top: "conv3_2" 168 | param { 169 | lr_mult: 1 170 | decay_mult: 1 171 | } 172 | param { 173 | lr_mult: 2 174 | decay_mult: 0 175 | } 176 | convolution_param { 177 | num_output: 256 178 | pad: 1 179 | kernel_size: 3 180 | stride: 1 181 | } 182 | } 183 | layer { 184 | name: "relu3_2" 185 | type: "ReLU" 186 | bottom: "conv3_2" 187 | top: "conv3_2" 188 | } 189 | layer { 190 | name: "conv3_3" 191 | type: "Convolution" 192 | bottom: "conv3_2" 193 | top: "conv3_3" 194 | param { 195 | lr_mult: 1 196 | decay_mult: 1 197 | } 198 | param { 199 | lr_mult: 2 200 | decay_mult: 0 201 | } 202 | convolution_param { 203 | num_output: 256 204 | pad: 1 205 | kernel_size: 3 206 | stride: 1 207 | } 208 | } 209 | layer { 210 | name: "relu3_3" 211 | type: "ReLU" 212 | bottom: "conv3_3" 213 | top: "conv3_3" 214 | } 215 | layer { 216 | name: "pool3" 217 | type: "Pooling" 218 | bottom: "conv3_3" 219 | top: "pool3" 220 | pooling_param { 221 | pool: MAX 222 | kernel_size: 2 223 | stride: 2 224 | } 225 | } 226 | layer { 227 | name: "conv4_1" 228 | type: "Convolution" 229 | bottom: "pool3" 230 | top: "conv4_1" 231 | param { 232 | lr_mult: 1 233 | decay_mult: 1 234 | } 235 | param { 236 | lr_mult: 2 237 | decay_mult: 0 238 | } 239 | convolution_param { 240 | num_output: 512 241 | pad: 1 242 | kernel_size: 3 243 | stride: 1 244 | } 245 | } 246 | layer { 247 | name: "relu4_1" 248 | type: "ReLU" 249 | bottom: "conv4_1" 250 | top: "conv4_1" 251 | } 252 | layer { 253 | name: "conv4_2" 254 | type: "Convolution" 255 | bottom: "conv4_1" 256 | top: "conv4_2" 257 | param { 258 | lr_mult: 1 259 | decay_mult: 1 260 | } 261 | param { 262 | lr_mult: 2 263 | decay_mult: 0 264 | } 265 | convolution_param { 266 | num_output: 512 267 | pad: 1 268 | kernel_size: 3 269 | stride: 1 270 | } 271 | } 272 | layer { 273 | name: "relu4_2" 274 | type: "ReLU" 275 | bottom: "conv4_2" 276 | top: "conv4_2" 277 | } 278 | layer { 279 | name: "conv4_3" 280 | type: "Convolution" 281 | bottom: "conv4_2" 282 | top: "conv4_3" 283 | param { 284 | lr_mult: 1 285 | decay_mult: 1 286 | } 287 | param { 288 | lr_mult: 2 289 | decay_mult: 0 290 | } 291 | convolution_param { 292 | num_output: 512 293 | pad: 1 294 | kernel_size: 3 295 | stride: 1 296 | } 297 | } 298 | layer { 299 | name: "relu4_3" 300 | type: "ReLU" 301 | bottom: "conv4_3" 302 | top: "conv4_3" 303 | } 304 | layer { 305 | name: "pool4" 306 | type: "Pooling" 307 | bottom: "conv4_3" 308 | top: "pool4" 309 | pooling_param { 310 | pool: MAX 311 | kernel_size: 2 312 | stride: 2 313 | } 314 | } 315 | layer { 316 | name: "conv5_1" 317 | type: "Convolution" 318 | bottom: "pool4" 319 | top: "conv5_1" 320 | param { 321 | lr_mult: 1 322 | decay_mult: 1 323 | } 324 | param { 325 | lr_mult: 2 326 | decay_mult: 0 327 | } 328 | convolution_param { 329 | num_output: 512 330 | pad: 1 331 | kernel_size: 3 332 | stride: 1 333 | } 334 | } 335 | layer { 336 | name: "relu5_1" 337 | type: "ReLU" 338 | bottom: "conv5_1" 339 | top: "conv5_1" 340 | } 341 | layer { 342 | name: "conv5_2" 343 | type: "Convolution" 344 | bottom: "conv5_1" 345 | top: "conv5_2" 346 | param { 347 | lr_mult: 1 348 | decay_mult: 1 349 | } 350 | param { 351 | lr_mult: 2 352 | decay_mult: 0 353 | } 354 | convolution_param { 355 | num_output: 512 356 | pad: 1 357 | kernel_size: 3 358 | stride: 1 359 | } 360 | } 361 | layer { 362 | name: "relu5_2" 363 | type: "ReLU" 364 | bottom: "conv5_2" 365 | top: "conv5_2" 366 | } 367 | layer { 368 | name: "conv5_3" 369 | type: "Convolution" 370 | bottom: "conv5_2" 371 | top: "conv5_3" 372 | param { 373 | lr_mult: 1 374 | decay_mult: 1 375 | } 376 | param { 377 | lr_mult: 2 378 | decay_mult: 0 379 | } 380 | convolution_param { 381 | num_output: 512 382 | pad: 1 383 | kernel_size: 3 384 | stride: 1 385 | } 386 | } 387 | layer { 388 | name: "relu5_3" 389 | type: "ReLU" 390 | bottom: "conv5_3" 391 | top: "conv5_3" 392 | } 393 | layer { 394 | name: "pool5" 395 | type: "Pooling" 396 | bottom: "conv5_3" 397 | top: "pool5" 398 | pooling_param { 399 | pool: MAX 400 | kernel_size: 2 401 | stride: 2 402 | } 403 | } 404 | layer { 405 | name: "fc6" 406 | type: "Convolution" 407 | bottom: "pool5" 408 | top: "fc6" 409 | param { 410 | lr_mult: 1 411 | decay_mult: 1 412 | } 413 | param { 414 | lr_mult: 2 415 | decay_mult: 0 416 | } 417 | convolution_param { 418 | num_output: 4096 419 | pad: 0 420 | kernel_size: 7 421 | stride: 1 422 | } 423 | } 424 | layer { 425 | name: "relu6" 426 | type: "ReLU" 427 | bottom: "fc6" 428 | top: "fc6" 429 | } 430 | layer { 431 | name: "fc7" 432 | type: "Convolution" 433 | bottom: "fc6" 434 | top: "fc7" 435 | param { 436 | lr_mult: 1 437 | decay_mult: 1 438 | } 439 | param { 440 | lr_mult: 2 441 | decay_mult: 0 442 | } 443 | convolution_param { 444 | num_output: 4096 445 | pad: 0 446 | kernel_size: 1 447 | stride: 1 448 | } 449 | } 450 | layer { 451 | name: "relu7" 452 | type: "ReLU" 453 | bottom: "fc7" 454 | top: "fc7" 455 | } 456 | layer { 457 | name: "score_fr" 458 | type: "Convolution" 459 | bottom: "fc7" 460 | top: "score_fr" 461 | param { 462 | lr_mult: 1 463 | decay_mult: 1 464 | } 465 | param { 466 | lr_mult: 2 467 | decay_mult: 0 468 | } 469 | convolution_param { 470 | num_output: 21 471 | pad: 0 472 | kernel_size: 1 473 | } 474 | } 475 | layer { 476 | name: "upscore" 477 | type: "Deconvolution" 478 | bottom: "score_fr" 479 | top: "upscore" 480 | param { 481 | lr_mult: 0 482 | } 483 | convolution_param { 484 | num_output: 21 485 | bias_term: false 486 | kernel_size: 64 487 | stride: 32 488 | } 489 | } 490 | layer { 491 | name: "score" 492 | type: "Crop" 493 | bottom: "upscore" 494 | bottom: "data" 495 | top: "score" 496 | crop_param { 497 | axis: 2 498 | offset: 19 499 | } 500 | } 501 | -------------------------------------------------------------------------------- /photon/cat_sprinkler.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Photon firmware 3 | * Assumes the relay board is wired to D0 4 | * 5 | * Commands: 6 | * sprinkle on 7 | * sprinkle off 8 | * 9 | */ 10 | 11 | int relay = D0; 12 | bool relay_on = false; 13 | long tstart = 0; 14 | long tend = 0; 15 | 16 | void setup() { 17 | pinMode(relay, OUTPUT); 18 | digitalWrite(relay, LOW); 19 | Particle.function("sprinkle", sprinkle); 20 | } 21 | 22 | void loop() { 23 | bool expired = false; 24 | if (relay_on) { 25 | int ct = millis(); 26 | if (tstart < tend && ct > tend) 27 | expired = true; 28 | else if (ct > tend && ct < tstart) 29 | expired = true; 30 | if (expired) { 31 | digitalWrite(relay, LOW); 32 | relay_on = false; 33 | tstart = 0; 34 | tend = 0; 35 | } 36 | } 37 | } 38 | int sprinkle(String command) { 39 | int rvalue = 1; 40 | if (command == "on") { 41 | digitalWrite(relay, HIGH); 42 | relay_on = true; 43 | tstart = millis(); 44 | tend = tstart + 1000 * 60 * 2; 45 | } else if (command == "off") { 46 | digitalWrite(relay, LOW); 47 | relay_on = false; 48 | tstart = 0; 49 | tend = 0; 50 | } else { 51 | rvalue = 0; 52 | } 53 | return rvalue; 54 | } 55 | 56 | -------------------------------------------------------------------------------- /python/count_pascal.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Dump the counts in a pascal context segmentation as converted by mat2png.py 3 | # Example: 4 | # $ count_pascal.py /images/sdb_seg/2009_001133.png 5 | # none 0 65781 6 | # sofa 18 109776 7 | # train 19 13443 8 | # 9 | 10 | import sys 11 | import time 12 | 13 | import numpy as np 14 | from PIL import Image 15 | 16 | import caffe 17 | 18 | labels = [ "none", "aeroplane", "bicycle", "bird", "boat", "bottle", "bus", "car", "cat", "chair", "cow", "table", "dog", 19 | "horse", "motorbike", "person", "pottedplant", "sheep", "sofa", "train", "tvmonitor", 20 | 21 | "bag", "bed", "bench", "book", "building", "cabinet", "ceiling", "cloth", "computer", "cup", "door", "fence", "floor", 22 | "flower", "food", "grass", "ground", "keyboard", "light", "mountain", "mouse", "curtain", "platform", "sign", 23 | "plate", "road", "rock", "shelves", "sidewalk", "sky", "snow", "bedclothes", "track", "tree", "truck", 24 | "wall", "water", "window", "wood" 25 | ] 26 | 27 | def dump_counts(out): 28 | count = np.zeros(len(labels), np.uint32) 29 | cols = out.shape[0] 30 | rows = out.shape[1] 31 | for y in range(cols): 32 | line = "" 33 | for x in range(rows): 34 | v = out[y, x] 35 | count[v] += 1 36 | s = str(v) 37 | line += s 38 | # print line 39 | for i in range(len(labels)): 40 | if count[i] > 0: 41 | print labels[i], i, count[i] 42 | 43 | im = Image.open(sys.argv[1]) 44 | in_ = np.array(im, dtype=np.uint8) 45 | dump_counts(in_) 46 | -------------------------------------------------------------------------------- /python/count_pascal_mat.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Call with .mat files on the command line 3 | # Understands the pascal voc segmentation used in the sdb .mat segmenations 4 | # Exmaple: 5 | # $ count_pascal_mat.py sdb/benchmark_RELEASE/dataset/cls/2008_006606.mat 6 | # sdb/benchmark_RELEASE/dataset/cls/2008_006606.mat none 142076 chair 17106 tvmonitor 7318 7 | 8 | 9 | import sys 10 | import time 11 | 12 | import numpy as np 13 | import scipy.io as sio 14 | 15 | import caffe 16 | 17 | labels = [ "none", "aeroplane", "bicycle", "bird", "boat", "bottle", "bus", "car", "cat", "chair", "cow", "table", "dog", 18 | "horse", "motorbike", "person", "pottedplant", "sheep", "sofa", "train", "tvmonitor", 19 | 20 | "bag", "bed", "bench", "book", "building", "cabinet", "ceiling", "cloth", "computer", "cup", "door", "fence", "floor", 21 | "flower", "food", "grass", "ground", "keyboard", "light", "mountain", "mouse", "curtain", "platform", "sign", 22 | "plate", "road", "rock", "shelves", "sidewalk", "sky", "snow", "bedclothes", "track", "tree", "truck", 23 | "wall", "water", "window", "wood" 24 | ] 25 | 26 | def dump_counts(out): 27 | count = np.zeros(500, np.uint32) 28 | cols = out.shape[0] 29 | rows = out.shape[1] 30 | for y in range(cols): 31 | for x in range(rows): 32 | v = out[y, x] 33 | count[v] += 1 34 | for i in range(len(count)): 35 | if count[i] > 0: 36 | if (i < len(labels)): 37 | print " ", labels[i], count[i], 38 | else: 39 | print " ", i, count[i], 40 | print 41 | 42 | for i in range(1, len(sys.argv)): 43 | mat = sio.loadmat(sys.argv[i]) 44 | mat = mat['GTcls'][0]['Segmentation'][0].astype(np.uint8) 45 | print sys.argv[i], 46 | dump_counts(mat) 47 | -------------------------------------------------------------------------------- /python/get_png_palette.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Gets the palette used in the pascal voc segmentation images. 3 | # Example: 4 | # $ ./get_png_palette.py 5 | # 0 none [0 0 0] 6 | # 1 aeroplane [128 0 0] 7 | # 2 bicycle [ 0 128 0] 8 | # 3 bird [128 128 0] 9 | # 4 boat [ 0 0 128] 10 | # 5 bottle [128 0 128] 11 | # 6 bus [ 0 128 128] 12 | # 7 car [128 128 128] 13 | # 8 cat [64 0 0] 14 | # 9 chair [192 0 0] 15 | # 10 cow [ 64 128 0] 16 | # 11 diningtable [192 128 0] 17 | # 12 dog [ 64 0 128] 18 | # 13 horse [192 0 128] 19 | # 14 motorbike [ 64 128 128] 20 | # 15 person [192 128 128] 21 | # 16 pottedplant [ 0 64 0] 22 | # 17 sheep [128 64 0] 23 | # 18 sofa [ 0 192 0] 24 | # 19 train [128 192 0] 25 | # 20 tvmonitor [ 0 64 128] 26 | 27 | from PIL import Image 28 | import numpy as np 29 | 30 | pascal_classes = [ 31 | 'none', 32 | 'aeroplane', 33 | 'bicycle', 34 | 'bird', 35 | 'boat', 36 | 'bottle', 37 | 'bus', 38 | 'car', 39 | 'cat', 40 | 'chair', 41 | 'cow', 42 | 'diningtable', 43 | 'dog', 44 | 'horse', 45 | 'motorbike', 46 | 'person', 47 | 'pottedplant', 48 | 'sheep', 49 | 'sofa', 50 | 'train', 51 | 'tvmonitor', 52 | ] 53 | 54 | # The Class version has the above indexes. 55 | # The Object version assigns indexes in order of the object xml. index 1 == object1, index 2 == object 2, ... 56 | 57 | im = Image.open("pascal_voc/VOCdevkit/VOC2012/SegmentationClass/2009_000488.png") 58 | 59 | palette = im.getpalette() 60 | num_colors = len(palette)/3 61 | palette = np.array(palette).reshape(num_colors, 3) 62 | 63 | for i in range(len(pascal_classes)): 64 | print i, pascal_classes[i], palette[i] 65 | -------------------------------------------------------------------------------- /python/last10.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Usage: last10.py 3 | # Shows the last 10 shots at 1/2 res 4 | # Keys: 5 | # j: show only .jpgs 6 | # p: show only .pngs 7 | # b: show both .jpg and .pngs. Default. 8 | # 9 | 10 | import sys 11 | import os 12 | import os.path as p 13 | 14 | import numpy as np 15 | import cv2 16 | 17 | raw="/caffe/outbound/raw" 18 | r = 160 19 | c = 320 20 | a = np.zeros((r * 5, c * 2, 3), dtype=np.uint8) 21 | jpegs = True 22 | pngs = True 23 | 24 | def pick_file(flist, fi): 25 | gotone = False 26 | while fi >= 0 and not gotone: 27 | fn = flist[fi] 28 | fn1, ext = p.splitext(fn) 29 | if jpegs and ext == ".jpg": 30 | gotone = True 31 | elif pngs and ext == ".png": 32 | gotone = True 33 | fi -= 1 34 | if gotone: 35 | return fi, fn 36 | else: 37 | return fi, None 38 | 39 | while True: 40 | flist = os.listdir(raw) 41 | flist.sort() 42 | fi = len(flist) - 1 43 | for x in [1, 0]: 44 | for y in [4, 3, 2, 1, 0]: 45 | fi, fn = pick_file(flist, fi) 46 | if fn: 47 | m = cv2.imread(raw + "/" + fn) 48 | if m != None: 49 | a[y*r:(y+1)*r, x*c:(x+1)*c] = cv2.resize(m, (c, r)) 50 | 51 | cv2.imshow("Last 10", a) 52 | 53 | key = cv2.waitKey(10000) 54 | if key == 27 or key == ord('q'): 55 | exit(0) 56 | elif key == ord('j'): 57 | jpegs = True 58 | pngs = False 59 | elif key == ord('p'): 60 | jpegs = False 61 | pngs = True 62 | elif key == ord('b'): 63 | jpegs = True 64 | pngs = True 65 | -------------------------------------------------------------------------------- /python/mask_out.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # mask_out file.jpg file.png 3 | # file.png should have a set of pascal voc segments. Replaces the png file 4 | # with a masked version of the .jpg 5 | palette = [ 6 | [0,0,0], 7 | [128,0,0], 8 | [0,128,0], 9 | [128,128,0], 10 | [0,0,128], 11 | [128,0,128], 12 | [0,128,128], 13 | [128,128,128], 14 | [64,0,0], 15 | [192,0,0], 16 | [64,128,0], 17 | [192,128,0], 18 | [64,0,128], 19 | [192,0,128], 20 | [64,128,128], 21 | [192,128,128], 22 | [0,64,0], 23 | [128,64,0], 24 | [0,192,0], 25 | [128,192,0], 26 | [0,64,128] 27 | ] 28 | 29 | import sys 30 | import os 31 | from PIL import Image 32 | import numpy as np 33 | 34 | jpg_fn = sys.argv[1] 35 | mask_fn = sys.argv[2] 36 | 37 | image = Image.open(jpg_fn) 38 | image = np.array(image, dtype=np.uint8) 39 | 40 | mask = Image.open(mask_fn) 41 | mask = np.array(mask, dtype=np.uint8) 42 | 43 | for i in range(1, len(palette)): 44 | image[mask == i] = palette[i] 45 | 46 | image = Image.fromarray(image) 47 | image.save(mask_fn) 48 | -------------------------------------------------------------------------------- /python/mat2png.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # argv[1] is the dest. directory 3 | # Converts a lsit of sdb segmented .mat files to .png files. 4 | # All arguments past that are source .mat files 5 | 6 | import sys 7 | import os.path 8 | 9 | import numpy as np 10 | import scipy.io as sio 11 | from PIL import Image 12 | 13 | dest_dir = sys.argv[1] 14 | for i in range(2, len(sys.argv)): 15 | src = sys.argv[i] 16 | src_base = os.path.basename(src) 17 | src_fn, src_ext = os.path.splitext(src_base) 18 | if src_ext != ".mat": 19 | print "Bad file name:", src 20 | continue 21 | dest = os.path.join(dest_dir, src_fn + '.png') 22 | print src, dest 23 | mat = sio.loadmat(sys.argv[i]) 24 | mat = mat['GTcls'][0]['Segmentation'][0].astype(np.uint8) 25 | im = Image.fromarray(mat) 26 | im.save(dest) 27 | -------------------------------------------------------------------------------- /python/movie.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Usage: [-t ms] movie file_list 3 | # Shows a bunch of .png or .jpg files at 1/3 second intervals 4 | # Handy for going through a bunch of images quickly 5 | # -t - set delay between frames. 6 | # 7 | 8 | import sys 9 | import os.path 10 | 11 | import numpy as np 12 | import cv2 13 | 14 | cv2.namedWindow("movie") 15 | cv2.moveWindow("movie", 300, 300) 16 | 17 | if len(sys.argv) == 1: 18 | exit(0) 19 | 20 | t = 330 21 | ai = 1 22 | if sys.argv[1] == "-t": 23 | t = int(sys.argv[2]) 24 | ai += 2 25 | 26 | for fn in sys.argv[ai:]: 27 | m = cv2.imread(fn) 28 | if m == None: 29 | continue 30 | cv2.imshow('movie', m); 31 | key = cv2.waitKey(t) 32 | key = key & 0xff 33 | if key == 27 or key == ord('q'): 34 | exit(0) 35 | elif key == ord('p'): 36 | print fn 37 | -------------------------------------------------------------------------------- /python/png2mat.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Converts a .png segmented image to a .mat segmented image 3 | 4 | import sys 5 | import scipy.io as sio 6 | import numpy as np 7 | from PIL import Image 8 | 9 | src = sys.argv[1] 10 | dest = sys.argv[2] 11 | 12 | im = Image.open(src) 13 | m = np.array(im, dtype=np.uint16) 14 | sio.savemat(dest, {'LabelMap':m}) 15 | -------------------------------------------------------------------------------- /python/resize.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Resizes an image to 640x360 3 | 4 | import os, sys 5 | from PIL import Image 6 | 7 | size = (640, 360) 8 | 9 | for fn in sys.argv[1:]: 10 | try: 11 | im = Image.open(fn) 12 | im = im.resize(size, Image.BICUBIC) 13 | im.save(fn) 14 | except IOError: 15 | print "oops" 16 | -------------------------------------------------------------------------------- /python/seg_fix.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # argv[1] is the dest. directory 3 | # All arguments past that are source .png files 4 | # An example of how to remap the segments in an image 5 | 6 | import sys 7 | import os.path 8 | 9 | import numpy as np 10 | import scipy.io as sio 11 | from PIL import Image 12 | 13 | dest_dir = sys.argv[1] 14 | for i in range(2, len(sys.argv)): 15 | src = sys.argv[i] 16 | src_base = os.path.basename(src) 17 | src_fn, src_ext = os.path.splitext(src_base) 18 | if src_ext != ".png": 19 | print "Bad file name:", src 20 | continue 21 | dest = os.path.join(dest_dir, src_fn + '.png') 22 | print src, dest 23 | im = Image.open(src) 24 | mat = np.array(im, dtype=np.uint8) 25 | fixed_mat = np.zeros_like(mat, dtype=np.uint8) 26 | for i in range(60, 76): 27 | fixed_mat[mat == i] = i - 60 + 1 28 | im = Image.fromarray(fixed_mat) 29 | im.save(dest) 30 | -------------------------------------------------------------------------------- /python/show_seg.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Usage: show_seg src.jpg seg.png 3 | # Shows the segmentation, given a base image and a segment 4 | # Picks a random palette. 5 | # Use the 't' key to toggle between the two 6 | 7 | import sys 8 | import os.path 9 | import random 10 | 11 | import numpy as np 12 | import cv2 13 | 14 | r = [0, 224, 32, 192, 64, 160, 128] 15 | def rn(): 16 | return r[random.randint(0, 6)] 17 | 18 | palette = [[0, 0, 0]] 19 | random.seed(2) 20 | for i in range(1, 256): 21 | v = [rn(), rn(), rn()] 22 | while v in palette: 23 | v = [rn(), rn(), rn()] 24 | palette += [v] 25 | 26 | if len(sys.argv) == 3: 27 | # Get filenames 28 | src_fn = sys.argv[1] 29 | seg_fn = sys.argv[2] 30 | 31 | src_mat = cv2.imread(src_fn, flags = 1) 32 | seg_mat = cv2.imread(seg_fn, flags = 0) 33 | 34 | # Paint src pixels 35 | src_pmat = src_mat.copy() 36 | for i in range(1, 256): 37 | src_pmat[seg_mat == i] = palette[i] 38 | 39 | cv2.namedWindow("show_seg") 40 | cv2.moveWindow("show_seg", 300, 300) 41 | 42 | cv2.imshow('show_seg', src_pmat); 43 | show_painted = True 44 | 45 | while True: 46 | key = cv2.waitKey(1) 47 | key = key & 0xff 48 | if key == 27 or key == ord('q'): 49 | exit(0) 50 | if key == ord('t'): 51 | show_painted = not show_painted 52 | if show_painted: 53 | cv2.imshow("show_seg", src_pmat) 54 | else: 55 | cv2.imshow("show_seg", src_mat) 56 | -------------------------------------------------------------------------------- /python/tcats.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Usage: tcats..py 3 | # Processes files that have been segmented by the FCN network 4 | # Get the labels for the segmented items, saves the images we care about 5 | # turns on the sprinkler for cats and dogs 6 | # 7 | 8 | import sys 9 | import os 10 | import os.path as p 11 | import subprocess 12 | import time 13 | 14 | from PIL import Image 15 | import numpy as np 16 | import cv2 17 | 18 | # Cats have to be bigger than this 19 | smallest_blob = 1400 20 | 21 | # Has a set of jpegs and pngs processed by tbatch_infer.py 22 | classified = "/caffe/classified" 23 | # Where the files go next 24 | outbound = "/caffe/outbound" 25 | raw = p.join(outbound, "raw") 26 | # How to kick off the photon 27 | sprinkle = "/home/rgb/bin/sprinkle.sh" 28 | # Log file for the counts 29 | count_log = "/caffe/fcn.berkeleyvision.org/counts.out" 30 | 31 | # Labels for everything the neural net can recognize. Indexes matter in this list 32 | labels = [ "none", "aeroplane", "bicycle", "bird", "boat", "bottle", "bus", "car", "cat", "chair", 33 | "cow", "table", "dog", "horse", "motorbike", "person", "pottedplant", "sheep", "sofa", 34 | "train", "tvmonitor"] 35 | 36 | # Turn the sprinkler on these guys 37 | sprinkle_list = ["cat", "dog"] 38 | 39 | # Keep these images around in outbound/item 40 | keep_list = ["cat", "dog", "person"] 41 | 42 | def get_list(png_fn): 43 | im = Image.open(png_fn) 44 | histo = im.histogram() 45 | indices = [] 46 | items = [] 47 | counts = [] 48 | for i in range(len(labels)): 49 | if histo[i] > 0: 50 | indices += [i] 51 | items += [labels[i]] 52 | counts += [histo[i]] 53 | return indices, items, counts 54 | 55 | while True: 56 | # Get a list of files 57 | flist = os.listdir(classified) 58 | flist.sort() 59 | if flist == None or len(flist) < 2: 60 | time.sleep(0.25) 61 | continue 62 | while len(flist) > 2: 63 | # Should be a .jpg and a .png with matching file names 64 | jpeg_fn = flist.pop(0) 65 | jpeg_full_src = p.join(classified, jpeg_fn) 66 | jpeg_base, jpeg_ext = p.splitext(jpeg_fn) 67 | if jpeg_ext != ".jpg": 68 | print "ignoring strange file: ", jpeg_fn 69 | os.remove(jpeg_full_src) 70 | continue 71 | png_fn = flist.pop(0) 72 | png_full_src = p.join(classified, png_fn) 73 | png_base, png_ext = p.splitext(png_fn) 74 | if png_ext != ".png" or jpeg_base != png_base: 75 | print "ignoring strange file pair ", jpeg_fn, png_fn 76 | os.remove(jpeg_full_src) 77 | os.remove(png_full_src) 78 | continue 79 | # Figure out where to save the images - everything goes to outbound/raw 80 | jpeg_full_dest = p.join(raw, jpeg_fn) 81 | png_full_dest = p.join(raw, png_fn) 82 | # Move to outbound/raw 83 | os.rename(jpeg_full_src, jpeg_full_dest) 84 | os.rename(png_full_src, png_full_dest) 85 | # Find the segmented pixels 86 | indices, items, counts = get_list(png_full_dest) 87 | log_line = jpeg_fn + ' ' 88 | num_items = len(items) 89 | # Do something with items we care about 90 | for i in range(num_items): 91 | index = indices[i] 92 | item = items[i] 93 | count = counts[i] 94 | if item in sprinkle_list: 95 | if "person" not in items and count > smallest_blob: 96 | subprocess.call(sprinkle) 97 | if item in keep_list: 98 | dest_dir = p.join(outbound, item) 99 | os.link(jpeg_full_dest, p.join(dest_dir, jpeg_fn)) 100 | os.link(png_full_dest, p.join(dest_dir, png_fn)) 101 | print jpeg_fn, "keeping", item, count 102 | else: 103 | print jpeg_fn, "skipping", item, count 104 | log_line += item + " " + str(index) + " " + str(count) 105 | if i < num_items - 1: 106 | log_line += " " 107 | # Log it 108 | with open(count_log, "a") as log: 109 | log.write(log_line + '\n') 110 | # spawn and forget a process to convert the png to a file we can see 111 | subprocess.Popen(["mask_out.py", jpeg_full_dest, png_full_dest]) 112 | -------------------------------------------------------------------------------- /python/yesno.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Usage: yesno.py file_list 3 | # Handy util used to bucket images. 4 | # Pass in a list of images on the command line. Output is two files, yes, and no. 5 | 6 | import sys 7 | import os.path 8 | 9 | import numpy as np 10 | import cv2 11 | 12 | cv2.namedWindow("yesno") 13 | cv2.moveWindow("yesno",300, 300) 14 | 15 | for fn in sys.argv[1:]: 16 | m = cv2.imread(fn) 17 | cv2.imshow('yesno', m); 18 | 19 | key = cv2.waitKey(0) 20 | key = key & 0xff 21 | if key == 27 or key == ord('q'): 22 | exit(0) 23 | elif key == ord('y'): 24 | with open("yes", 'a') as f: 25 | f.write(fn + '\n') 26 | else: 27 | with open("no", 'a') as f: 28 | f.write(fn + '\n') 29 | 30 | 31 | -------------------------------------------------------------------------------- /python/zip_dir.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # zips together two directories 3 | # Usage zip_dir.py d1 d2 ext1 ext2 4 | 5 | import sys 6 | import os 7 | import os.path as p 8 | 9 | if len(sys.argv) == 5: 10 | d1 = sys.argv[1] 11 | d2 = sys.argv[2] 12 | ext1 = sys.argv[3] 13 | ext2 = sys.argv[4] 14 | 15 | if not p.exists(d1) or not p.exists(d2): 16 | print "Bad diretory neames" 17 | exit(1) 18 | d1 = p.abspath(d1) 19 | d2 = p.abspath(d2) 20 | 21 | d1_files = os.listdir(d1) 22 | 23 | for f in d1_files: 24 | fn1_base = p.basename(f) 25 | fn1, fn1_ext = p.splitext(fn1_base) 26 | if fn1_ext != ext1: 27 | continue 28 | full_fn1 = p.join(d1, fn1 + ext1) 29 | if not p.exists(full_fn1): 30 | print "oops:", full_fn1 31 | exit(1) 32 | full_fn2 = p.join(d2, fn1 + ext2) 33 | if not p.exists(full_fn2): 34 | continue 35 | print full_fn1, full_fn2 36 | -------------------------------------------------------------------------------- /python/zip_neg.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # zips together the neg directory with a single file for the segmenation 3 | # Usage zip_dir.py neg_dir ext neg_seg.png 4 | 5 | import sys 6 | import os 7 | import os.path as p 8 | 9 | if len(sys.argv) == 4: 10 | d1 = sys.argv[1] 11 | ext = sys.argv[2] 12 | neg = sys.argv[3] 13 | 14 | if not p.exists(d1): 15 | print "Bad directory name" 16 | exit(1) 17 | if not p.exists(neg): 18 | print "Bad neg seg" 19 | exit(1) 20 | 21 | full_fn2 = p.abspath(neg) 22 | 23 | if not p.exists(full_fn2): 24 | print "oops:", full_fn2 25 | exit(1) 26 | 27 | d1 = p.abspath(d1) 28 | d1_files = os.listdir(d1) 29 | d1_files.sort() 30 | 31 | for f in d1_files: 32 | fn1_base = p.basename(f) 33 | fn1, fn1_ext = p.splitext(fn1_base) 34 | if fn1_ext != ext: 35 | continue 36 | full_fn1 = p.join(d1, fn1 + ext) 37 | if not p.exists(full_fn1): 38 | print "oops:", full_fn1 39 | exit(1) 40 | print full_fn1, full_fn2 41 | -------------------------------------------------------------------------------- /scripts/cats.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Simple minded script that starts up caffe and runs batch_infer.py when a set of 3 | # images appear in the inbound dirctory. This is simple but not the best to use 4 | # because you are penalized the cost of the startup on each bacth of files. 5 | # See tcats.sh for a better approach 6 | cd /caffe/fcn* 7 | echo "starting declean.sh" 8 | dclean.sh & 9 | date > caffe.out 10 | while true 11 | do 12 | find /caffe/inbound -type f -name '*.jpg' -print | sort > tmp1 13 | if [ -s tmp1 ] 14 | then 15 | echo running caffe 16 | ./batch_infer.py `cat tmp1` >> caffe.out 2>&1 17 | cat tmp1 | 18 | while read yard 19 | do 20 | result=`echo $yard | sed s/.jpg$/.png/` 21 | pascal_histo $result > tmp2 22 | mask_out.py $yard $result 23 | ybn=`basename $yard` 24 | ydn=/caffe/outbound/raw/$ybn 25 | rbn=`basename $result` 26 | rdn=/caffe/outbound/raw/$rbn 27 | echo $ybn `cat tmp2` >> counts.out 28 | mv $yard $ydn 29 | mv $result $rdn 30 | cat tmp2 | 31 | while read line 32 | do 33 | i=`echo $line | awk '{print $1}'` 34 | case "$i" in 35 | cat|bird) 36 | ln $ydn /caffe/outbound/$i 37 | ln $rdn /caffe/outbound/$i 38 | echo "keeping $ybn: $i" 39 | hr=`date +%H` 40 | if [ $hr -lt 8 ] || [ $hr -ge 20 ] 41 | then 42 | date 43 | echo "running sprinkler" 44 | /caffe/photon/sprinkle.sh 45 | fi 46 | ;; 47 | aeroplane|bicycle|boat|bottle|bus|car|chair|\ 48 | table|dog|horse|motorbike|person|sofa|train|tvmonitor) 49 | ln $ydn /caffe/outbound/$i 50 | ln $rdn /caffe/outbound/$i 51 | echo "keeping $ybn: $i" 52 | ;; 53 | none|pottedplant|sheep|cow|\ 54 | *) 55 | echo "skipping $ybn: $i" 56 | ;; 57 | esac 58 | done 59 | done 60 | echo "Files processed" 61 | fi 62 | sleep 1 63 | done 64 | -------------------------------------------------------------------------------- /scripts/dclean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # monitors the ftp directory for innbound images 3 | # Any file found gets the permissions fixed and moved to /caffe/inbound 4 | m="/caffe/camera_home/FI9800P_00626E61E0D6/snap" 5 | d="/caffe/inbound" 6 | while true 7 | do 8 | find $m -type f -name '*.jpg' | 9 | while read ffn 10 | do 11 | file=`basename $ffn` 12 | chmod 644 $ffn 13 | mv $ffn $d/$file 14 | done 15 | sleep 1 16 | done 17 | -------------------------------------------------------------------------------- /scripts/spoff: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo Sprinkler disabled 3 | touch /home/rgb/bin/sprinkler_off 4 | -------------------------------------------------------------------------------- /scripts/spon: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo Sprinkler enabled 3 | rm -f /home/rgb/bin/sprinkler_off 4 | -------------------------------------------------------------------------------- /scripts/sprinkle.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ -f /home/rgb/bin/sprinkler_off ] 3 | then 4 | echo "Sprinkle disabled" 5 | exit 0 6 | fi 7 | curl https://api.particle.io/v1/devices/id/sprinkle -d access_token=token -d params=on 8 | -------------------------------------------------------------------------------- /scripts/sprinkle_off.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | curl https://api.particle.io/v1/devices/id/sprinkle -d access_token=token -d params=off 3 | -------------------------------------------------------------------------------- /scripts/tcats.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Starts the whole process. 3 | # 4 | cd /caffe/fcn* 5 | echo staring dclean 6 | dclean.sh & 7 | echo starting caffe 8 | ./tbatch_infer.py >> caffe.out 2>&1 & 9 | echo starting tcats.py 10 | tcats.py 11 | -------------------------------------------------------------------------------- /src/Makefile: -------------------------------------------------------------------------------- 1 | libs = -L/usr/local/lib 2 | libs += -L/usr/local/cuda-7.5/lib64 3 | libs += -lopencv_calib3d 4 | libs += -lopencv_contrib 5 | libs += -lopencv_core 6 | libs += -lopencv_features2d 7 | libs += -lopencv_flann 8 | libs += -lopencv_gpu 9 | libs += -lopencv_highgui 10 | libs += -lopencv_imgproc 11 | libs += -lopencv_legacy 12 | libs += -lopencv_ml 13 | libs += -lopencv_objdetect 14 | libs += -lopencv_photo 15 | libs += -lopencv_stitching 16 | libs += -lopencv_superres 17 | libs += -lopencv_ts 18 | libs += -lopencv_video 19 | libs += -lopencv_videostab 20 | libs += -lcufft 21 | libs += -lnpps 22 | libs += -lnppi 23 | libs += -lnppc 24 | libs += -lcudart 25 | libs += -lrt 26 | libs += -lpthread 27 | libs += -lm 28 | libs += -ldl 29 | 30 | inc += -I/usr/local/include 31 | inc += -I/usr/local/include/opencv 32 | inc += -I/usr/local/caffe/include 33 | inc += -I/usr/local/cuda-7.5/include 34 | 35 | CFLAGS=-g 36 | UTILS = bright cropper example snapshots extract_fg 37 | 38 | all: $(UTILS) 39 | clean: 40 | rm -f $(UTILS) *.o 41 | example: example.o 42 | g++ $(CFLAGS) -o example example.o $(libs) 43 | example.o: example.cpp 44 | g++ $(CFLAGS) $(inc) -c example.cpp 45 | bright.o: bright.cpp 46 | g++ $(CFLAGS) $(inc) -c bright.cpp 47 | bright: bright.o 48 | g++ $(CFLAGS) -o bright bright.o $(libs) 49 | snapshots.o: snapshots.cpp 50 | g++ $(CFLAGS) $(inc) -c snapshots.cpp 51 | snapshots: snapshots.o 52 | g++ $(CFLAGS) -o snapshots snapshots.o $(libs) 53 | cropper.o: cropper.cpp 54 | g++ $(CFLAGS) $(inc) -c cropper.cpp 55 | cropper: cropper.o 56 | g++ $(CFLAGS) -o cropper cropper.o $(libs) 57 | extract_fg.o: extract_fg.cpp 58 | g++ $(CFLAGS) $(inc) -c extract_fg.cpp 59 | extract_fg: extract_fg.o 60 | g++ $(CFLAGS) -o extract_fg extract_fg.o $(libs) 61 | -------------------------------------------------------------------------------- /src/bright.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | # Brightens a picture 3 | * Usage: bright src dest alpha beta 4 | */ 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | using namespace cv; 11 | 12 | int main( int argc, char** argv ) 13 | { 14 | Mat src = imread(argv[1]); 15 | 16 | double alpha = atof(argv[3]); 17 | int beta = atoi(argv[4]); 18 | 19 | 20 | Mat dest; 21 | src.convertTo(dest, -1, alpha, beta); 22 | 23 | imwrite(argv[2], dest); 24 | 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /src/cropper.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Crops a picture 3 | # cropper image from 256 x 256 to 227 x 227 4 | */ 5 | #include 6 | #include 7 | 8 | using namespace cv; 9 | 10 | int main( int argc, char** argv ) 11 | { 12 | char* imageName = argv[1]; 13 | 14 | Mat image; 15 | image = imread( imageName, CV_LOAD_IMAGE_COLOR); 16 | 17 | if( argc != 2 || !image.data ) { 18 | printf( " No image data \n " ); 19 | return -1; 20 | } 21 | 22 | if (image.cols <= 227 && image.rows <= 227) 23 | return 0; 24 | 25 | Rect r(14, 14, 227, 227); 26 | Rect fr(0, 0, image.cols, image.rows); 27 | r = r & fr; 28 | 29 | Mat cropped = image(r); 30 | 31 | imwrite(imageName, cropped); 32 | 33 | /* 34 | namedWindow( "original", CV_WINDOW_AUTOSIZE ); 35 | namedWindow( "cropped", CV_WINDOW_AUTOSIZE ); 36 | 37 | imshow("original", image); 38 | imshow("cropped", cropped); 39 | 40 | waitKey(0); 41 | */ 42 | 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /src/example.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Simple examle to use to debug opencv installatins 3 | */ 4 | 5 | #include 6 | #include "opencv2/opencv.hpp" 7 | #include "opencv2/gpu/gpu.hpp" 8 | 9 | using namespace std; 10 | using namespace cv; 11 | using namespace cv::gpu; 12 | 13 | int main (int argc, char* argv[]) 14 | { 15 | try 16 | { 17 | Mat src_host = cv::imread("../images/ecat/MDAlarm_20160531-231431.jpg", CV_LOAD_IMAGE_GRAYSCALE); 18 | GpuMat dst, src; 19 | src.upload(src_host); 20 | gpu::threshold(src, dst, 128.0, 255.0, CV_THRESH_BINARY); 21 | Mat result_host; 22 | dst.download(result_host); 23 | imshow("Result", result_host); 24 | waitKey(); 25 | } 26 | catch(const cv::Exception& ex) 27 | { 28 | cout << "Error: " << ex.what() << std::endl; 29 | } 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /src/extract_fg.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Foreground extraction routine 3 | * Usage: 4 | * extract_fg photo bg_photo dest_dir seg_dir 5 | * Subtracts bg_photo from photo. Saves photo in dest_dir and segmenation in seg_dir 6 | * 7 | * extract_fg -s photo dest_dir seg_dir 8 | * Edits photo and segmentation in seg_dir, saves in dest_dir and seg_dir 9 | * 10 | * Use the mouse to select an area then hit a key on the keyboard: 11 | * c - clear all pixels in the selection 12 | * s - set all pixels in the selection 13 | * w - magnifies the selection in another window 14 | * 1,2,3,4,6,8: sets the magnification for the next "w" command 15 | * a,o,e - work on cat, dog or person pixels, defaults to cat 16 | * d - attempnt to find and clear shadown pixels 17 | * q - save files and exit 18 | * ESC - exit without saving files 19 | * 20 | */ 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #include "opencv2/core/core.hpp" 29 | #include "opencv2/gpu/gpu.hpp" 30 | #include "opencv2/highgui/highgui.hpp" 31 | 32 | using namespace std; 33 | using namespace cv; 34 | using namespace cv::gpu; 35 | 36 | const uint8_t cat_seg_value = 17; 37 | const uint8_t dog_seg_value = 18; 38 | const uint8_t person_seg_value = 19; 39 | 40 | // #define USE_VIBE 41 | 42 | // options 43 | bool use_bg_photo = true; 44 | string photo_filename; 45 | string bg_filename; 46 | string dest_jpg; // A copy of photo_filename 47 | string dest_png; // The segmented image 48 | string dest_dir; 49 | string seg_dir; 50 | int cur_seg_value = cat_seg_value; 51 | 52 | void parse_options(int argc, char *argv[]) 53 | { 54 | int c; 55 | 56 | while ((c = getopt(argc, argv, "aeosv")) != -1) { 57 | switch (c) { 58 | case 'a': 59 | printf("Start with cat segs\n"); 60 | cur_seg_value = cat_seg_value; 61 | break; 62 | case 'o': 63 | printf("Start with dog segs\n"); 64 | cur_seg_value = dog_seg_value; 65 | break; 66 | case 'e': 67 | printf("Start with person segs\n"); 68 | cur_seg_value = person_seg_value; 69 | break; 70 | case 's': 71 | use_bg_photo = false; 72 | printf("Don't use bg photo\n"); 73 | break; 74 | default: 75 | printf("Huh\n"); 76 | exit(1); 77 | } 78 | } 79 | int nargs = use_bg_photo ? 4 : 3; 80 | if (optind + nargs != argc) { 81 | printf("usage: extract_fg photo bg dest_dir seg_dir\n"); 82 | printf(" extract_fg -s photo dest_dir seg_dir\n"); 83 | exit(1); 84 | } 85 | 86 | photo_filename = string(argv[optind++]); 87 | if (use_bg_photo) 88 | bg_filename = string(argv[optind++]); 89 | dest_dir = string(argv[optind++]); 90 | seg_dir = string(argv[optind++]); 91 | 92 | size_t i = photo_filename.rfind("/", photo_filename.length()); 93 | string pfn = photo_filename.substr(i+1, photo_filename.length() - 1); 94 | i = pfn.find("."); 95 | string pb = pfn.substr(0, i); 96 | dest_jpg = dest_dir + string("/") + pfn; 97 | dest_png = seg_dir + string("/") + pb + string(".png"); 98 | } 99 | 100 | // globals 101 | GpuMat d_bg; 102 | Mat bg; 103 | Mat frame; 104 | Mat fg_src; 105 | Mat fg; 106 | int mag = 4; 107 | 108 | static void grab_background() 109 | { 110 | bg = imread(bg_filename.c_str()); 111 | if (bg.empty()) { 112 | printf("Can't read background frame %s!\n", 113 | bg_filename.c_str()); 114 | exit(1); 115 | } 116 | imshow("bg", bg); 117 | 118 | try { 119 | GpuMat d_tmp(bg); 120 | gpu::GaussianBlur(d_tmp, d_bg, Size(3, 3), 0.0, 0,0); 121 | } 122 | catch (int e) { 123 | cout << "Exception: " << e << " on GPU acess in grab_background" << endl; 124 | } 125 | } 126 | 127 | void reload_fg(uint8_t cur_seg) 128 | { 129 | fg = Mat::zeros(fg_src.rows, fg_src.cols, CV_8UC1); 130 | 131 | for (int y = 0; y < fg_src.rows; y++) { 132 | for (int x = 0; x < fg_src.cols; x++) { 133 | uint8_t c = fg_src.at(y, x); 134 | if (c == cur_seg) 135 | fg.at(y, x) = 255; 136 | else if (c > 0) 137 | fg.at(y, x) = 128; 138 | } 139 | } 140 | } 141 | 142 | static void save_files() 143 | { 144 | Mat oframe = Mat::zeros(frame.rows, frame.cols, CV_8UC1); 145 | 146 | for (int y = 0; y < fg.rows; y++) { 147 | for (int x = 0; x < fg.cols; x++) { 148 | uint8_t c = fg.at(y, x); 149 | if (c > 0) 150 | oframe.at(y, x) = fg_src.at(y, x); 151 | } 152 | } 153 | 154 | cout << "Writing: " << dest_jpg << " " << dest_png << endl; 155 | 156 | string system_cmd = "cp " + photo_filename + " " + dest_jpg; 157 | system(system_cmd.c_str()); 158 | imwrite(dest_png.c_str(), oframe); 159 | } 160 | 161 | void clear_shadows() 162 | { 163 | for (int y = 0; y < frame.rows; y++) { 164 | for (int x = 0; x < frame.cols; x++) { 165 | uchar f = fg.at(y, x); 166 | if (f > 250) { 167 | Vec3b fp = frame.at(y, x); 168 | Vec3b bp = bg.at(y, x); 169 | int ncolor = 0; 170 | for (int i = 0; i < 3; i++) { 171 | int delta = bp[i] - fp[i]; 172 | if (delta > 0 && delta < 40) 173 | ncolor++; 174 | } 175 | if (ncolor == 3) 176 | fg.at(y, x) = 0; 177 | } 178 | } 179 | } 180 | } 181 | 182 | uchar mag_tbl[256]; 183 | 184 | // Adaptive linear table... 185 | // Adjusts contrast of items in the roi window 186 | void build_mag_tbl(Mat &photo_sub, Mat &fg_sub) 187 | { 188 | const float b0 = 50.0; 189 | const float b1 = 250.0; 190 | int min = 255.0; 191 | int max = 0.0; 192 | for (int y = 0; y < photo_sub.rows; y++) { 193 | for (int x = 0; x < photo_sub.cols; x++) { 194 | uchar f = fg_sub.at(y, x); 195 | if (f > 250) { 196 | Vec3b p = photo_sub.at(y, x); 197 | for (int i = 0; i < 3; i++) { 198 | if (p[i] < min) 199 | min = p[i]; 200 | if (p[i] > max) 201 | max = p[i]; 202 | } 203 | } 204 | } 205 | } 206 | float a = (b1-b0)/(float)(max - min); 207 | float b = b1 - a * (float)max; 208 | // cout << "a, b " << " " << a << " " << b << endl; 209 | 210 | for (int i = 0; i < 256; i++) 211 | mag_tbl[i] = saturate_cast((int)(a * (float) i + b + 0.5)); 212 | } 213 | 214 | // Nice blocky pixels, no anti-aliasing 215 | void blk_resize(Mat &photo_sub, Mat &fg_sub, Mat &dest) 216 | { 217 | build_mag_tbl(photo_sub, fg_sub); 218 | int xf = dest.cols / fg_sub.cols; 219 | int yf = dest.rows / fg_sub.rows; 220 | assert(xf >= 1 && yf >= 1); 221 | assert(fg_sub.type() == CV_8UC1 && dest.type() == CV_8UC3); 222 | for (int y = 0; y < dest.rows; y++) { 223 | for (int x = 0; x < dest.cols; x++) { 224 | uchar f = fg_sub.at(y / yf, x / xf); 225 | if (f > 250) { 226 | Vec3b p = photo_sub.at(y / yf, x / xf); 227 | p[0] = mag_tbl[p[0]]; 228 | p[1] = mag_tbl[p[1]]; 229 | p[2] = mag_tbl[p[2]]; 230 | dest.at(y, x) = p; 231 | } else { 232 | dest.at(y, x) = Vec3b(0, 0, 0); 233 | } 234 | } 235 | } 236 | } 237 | 238 | 239 | // TODO This really needs to be a window class... Would clean up on_mouse() and 240 | // clean up the subroutines supporting the case statement in main() 241 | struct mouse_info { 242 | string window; 243 | bool select_flag; 244 | bool drag; 245 | Point point1; 246 | Rect roi; 247 | Mat *pmat; 248 | }; 249 | 250 | static void on_mouse(int event, int x, int y, int flags, void *userdata) 251 | { 252 | struct mouse_info *mi = (struct mouse_info *) userdata; 253 | if (event == CV_EVENT_LBUTTONDOWN && !mi->drag) { 254 | mi->select_flag = false; 255 | mi->point1 = Point(x, y); 256 | mi->drag = true; 257 | } 258 | if (event == CV_EVENT_MOUSEMOVE && mi->drag) { 259 | Mat m = mi->pmat->clone(); 260 | Point point2 = Point(x, y); 261 | Rect rect = Rect(mi->point1, point2); 262 | Rect ir(0, 0, mi->pmat->cols, mi->pmat->rows); 263 | rect = rect & ir; 264 | bitwise_not(m(rect), m(rect)); 265 | imshow(mi->window.c_str(), m); 266 | } 267 | if (event == CV_EVENT_LBUTTONUP && mi->drag) { 268 | mi->drag = false; 269 | Point point2 = Point(x, y); 270 | mi->roi = Rect(mi->point1, point2); 271 | Rect ir(0, 0, mi->pmat->cols, mi->pmat->rows); 272 | mi->roi = mi->roi & ir; 273 | mi->select_flag = true; 274 | } 275 | } 276 | 277 | struct adj { 278 | double alpha; 279 | double beta; 280 | } adj[] = { 281 | { 1.0, 4.0 }, 282 | { 1.0, 2.0 }, 283 | { 1.0, 1.0 }, 284 | { 1.0, 1.0 }, 285 | { 1.0, 0.0 }, 286 | { 1.0, 0.0 }, 287 | { 1.0, 0.0 }, 288 | { 1.0, -1.0 }, 289 | { 1.0, -1.0 }, 290 | { 1.0, -2.0 }, 291 | { 1.0, -4.0 }, 292 | }; 293 | 294 | // Main pixel processing 295 | void process_frame() 296 | { 297 | #ifdef USE_VIBE 298 | gpu::VIBE_GPU *pbg = new VIBE_GPU(); 299 | #else 300 | gpu::MOG2_GPU *pbg = new MOG2_GPU(); 301 | pbg->nShadowDetection = 255; 302 | #endif 303 | GpuMat d_fg; 304 | 305 | for (int i = 0; i < sizeof(adj)/sizeof(struct adj); i++) { 306 | GpuMat d_adj; 307 | d_bg.convertTo(d_adj, -1, adj[i].alpha, adj[i].beta); 308 | pbg->operator()(d_adj, d_fg); 309 | } 310 | GpuMat d_frame(frame); 311 | 312 | GpuMat d_tmp; 313 | gpu::GaussianBlur(d_frame, d_tmp, Size(3, 3), 0.0, 0,0); 314 | 315 | pbg->operator()(d_tmp, d_fg); 316 | d_fg.download(fg); 317 | 318 | // Clear out the frame header in fg 319 | Rect to_clear(0, 0, 240, 30); 320 | fg(to_clear).setTo(Scalar(0)); 321 | 322 | // Load fg_src 323 | fg_src = Mat::zeros(fg.rows, fg.cols, CV_8UC1); 324 | 325 | for (int y = 0; y < fg.rows; y++) { 326 | for (int x = 0; x < fg.cols; x++) { 327 | uint8_t c = fg.at(y, x); 328 | if (c >= 250) 329 | fg_src.at(y, x) = cur_seg_value; 330 | } 331 | } 332 | } 333 | 334 | // Set the segment we are working on 335 | void set_seg_value(int v) 336 | { 337 | cur_seg_value = v; 338 | reload_fg(cur_seg_value); 339 | imshow("fg", fg); 340 | } 341 | 342 | // Map an roi window selection to the main window 343 | Rect get_fg_rect(mouse_info &fg_window, mouse_info &roi_window) 344 | { 345 | Point fg_point1(fg_window.roi.x + roi_window.roi.x / mag, 346 | fg_window.roi.y + roi_window.roi.y / mag); 347 | Size fg_size(roi_window.roi.width / mag, roi_window.roi.height / mag); 348 | return Rect(fg_point1, fg_size); 349 | } 350 | 351 | // Propogate info from main window & refresh roi window 352 | void refresh_roi(mouse_info &fg_window, mouse_info &roi_window) 353 | { 354 | Mat fg_sub = fg(fg_window.roi); 355 | Mat photo_sub = frame(fg_window.roi); 356 | *roi_window.pmat = Mat(fg_window.roi.height * mag, fg_window.roi.width * mag, CV_8UC3); 357 | blk_resize(photo_sub, fg_sub, *roi_window.pmat); 358 | imshow("roi", *roi_window.pmat); 359 | roi_window.select_flag = false; 360 | roi_window.drag = false; 361 | } 362 | 363 | // Set or clear pixels in the selected roi 364 | void set_roi(mouse_info &fg_window, mouse_info &roi_window, Scalar v1, Scalar v2) 365 | { 366 | if (fg_window.select_flag) { 367 | fg(fg_window.roi).setTo(v1); 368 | fg_src(fg_window.roi).setTo(v2); 369 | imshow("fg", fg); 370 | fg_window.select_flag = false; 371 | } else if (roi_window.select_flag) { 372 | Rect fg_rect = get_fg_rect(fg_window, roi_window); 373 | fg(fg_rect).setTo(v1); 374 | fg_src(fg_rect).setTo(v2); 375 | imshow("fg", fg); 376 | refresh_roi(fg_window, roi_window); 377 | } 378 | } 379 | 380 | int main(int argc, char* argv[]) 381 | { 382 | int64 st; 383 | FILE *fp; 384 | 385 | printf("extract_fg\n"); 386 | parse_options(argc, argv); 387 | fflush(stdout); 388 | 389 | namedWindow("photo", CV_WINDOW_AUTOSIZE); 390 | if (use_bg_photo) 391 | namedWindow("bg", CV_WINDOW_AUTOSIZE); 392 | namedWindow("fg", CV_WINDOW_AUTOSIZE); 393 | namedWindow("roi", CV_WINDOW_AUTOSIZE); 394 | 395 | moveWindow("photo", 100, 100); 396 | if (use_bg_photo) 397 | moveWindow("bg", 800, 100); 398 | moveWindow("fg", 100, 550); 399 | moveWindow("roi", 800, 550); 400 | 401 | struct mouse_info fg_window; 402 | fg_window.window = string("fg"); 403 | fg_window.select_flag = false; 404 | fg_window.drag = false; 405 | fg_window.pmat = &fg; 406 | setMouseCallback("fg", on_mouse, &fg_window); 407 | 408 | Mat big_fg; 409 | struct mouse_info roi_window; 410 | roi_window.window = string("roi"); 411 | roi_window.pmat = &big_fg; 412 | 413 | frame = imread(photo_filename.c_str()); 414 | 415 | if (use_bg_photo) { 416 | grab_background(); 417 | process_frame(); 418 | } else { 419 | fg_src = imread(dest_png.c_str(), CV_LOAD_IMAGE_GRAYSCALE); 420 | assert(!fg_src.empty()); 421 | assert(fg_src.rows == frame.rows && fg_src.cols == frame.cols); 422 | assert(fg_src.type() == CV_8UC1); 423 | reload_fg(cur_seg_value); 424 | } 425 | 426 | imshow("fg", fg); 427 | imshow("photo", frame); 428 | 429 | bool done = false; 430 | while(!done) 431 | { 432 | int key = waitKey(0); 433 | if (key == -1) 434 | continue; 435 | key &= 0xff; 436 | switch (key) { 437 | case 27: 438 | done = true; 439 | break; 440 | case 'q': 441 | done = true; 442 | save_files(); 443 | imshow("fg", fg); 444 | break; 445 | case 'a': 446 | set_seg_value(cat_seg_value); 447 | break; 448 | case 'o': 449 | set_seg_value(dog_seg_value); 450 | break; 451 | case 'e': 452 | set_seg_value(person_seg_value); 453 | break; 454 | case '1': 455 | case '2': 456 | case '3': 457 | case '4': 458 | case '6': 459 | case '8': 460 | mag = key - '0'; 461 | break; 462 | case 'd': 463 | clear_shadows(); 464 | imshow("fg", fg); 465 | break; 466 | case 'c': 467 | set_roi(fg_window, roi_window, Scalar(0), Scalar(0)); 468 | break; 469 | case 's': 470 | set_roi(fg_window, roi_window, Scalar(255), Scalar(cur_seg_value)); 471 | break; 472 | case 'w': 473 | if (fg_window.select_flag) { 474 | imshow("fg", fg); 475 | fg_window.select_flag = false; 476 | refresh_roi(fg_window, roi_window); 477 | setMouseCallback("roi", on_mouse, &roi_window); 478 | } 479 | default: 480 | break; 481 | } 482 | } 483 | 484 | 485 | 486 | destroyWindow("fg"); 487 | destroyWindow("photo"); 488 | if (use_bg_photo) 489 | destroyWindow("bg"); 490 | destroyWindow("roi"); 491 | 492 | if (use_bg_photo) 493 | d_bg.release(); 494 | 495 | exit(0); 496 | } 497 | -------------------------------------------------------------------------------- /src/snapshots.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Convert a movie to a set of still frames 3 | */ 4 | #include 5 | #include 6 | 7 | #include "opencv2/core/core.hpp" 8 | #include "opencv2/gpu/gpu.hpp" 9 | #include "opencv2/highgui/highgui.hpp" 10 | 11 | using namespace std; 12 | using namespace cv; 13 | using namespace cv::gpu; 14 | 15 | int main(int argc, char* argv[]) 16 | { 17 | int64 st; 18 | Mat frame; 19 | 20 | // open the video file for reading 21 | VideoCapture cap(0); 22 | 23 | if (!cap.isOpened()) { 24 | cout << "Cannot open the video file" << endl; 25 | return -1; 26 | } 27 | 28 | if (!cap.read(frame)) { 29 | cout << "Cannot read the video file" << endl; 30 | return -1; 31 | } 32 | 33 | namedWindow("vid", CV_WINDOW_AUTOSIZE); 34 | 35 | int frame_number = 0; 36 | bool done = false; 37 | while(!done) { 38 | double dt; 39 | cap.read(frame); // read a new frame from video 40 | 41 | if (frame.empty()) 42 | break; 43 | 44 | imshow("vid", frame); 45 | 46 | // Wait 1ms or for any key 47 | int key; 48 | key = waitKey(1) & 0xff; 49 | switch(key) { 50 | case 27: 51 | case 'q': 52 | done = true; 53 | break; 54 | case 's': 55 | frame_number++; 56 | char file_name[50]; 57 | sprintf(file_name, "snap_%02d.png", frame_number); 58 | imwrite(file_name, frame); 59 | break; 60 | } 61 | } 62 | 63 | return 0; 64 | } 65 | --------------------------------------------------------------------------------