├── apps └── __init__.py ├── logs ├── model.log ├── worker.log └── webcategory.log ├── .gitignore ├── util ├── pyleargist-2.0.5 │ ├── VERSION.txt │ ├── src │ │ ├── pyleargist.egg-info │ │ │ ├── dependency_links.txt │ │ │ ├── top_level.txt │ │ │ ├── SOURCES.txt │ │ │ └── PKG-INFO │ │ └── leargist.pyx │ ├── setup.cfg │ ├── MANIFEST.in │ ├── lear_gist │ │ ├── ar.ppm │ │ ├── compute_gist.dSYM │ │ │ └── Contents │ │ │ │ ├── Resources │ │ │ │ └── DWARF │ │ │ │ │ └── compute_gist │ │ │ │ └── Info.plist │ │ ├── Makefile │ │ ├── standalone_image.h │ │ ├── gist.h │ │ ├── README │ │ ├── standalone_image.c │ │ └── compute_gist.c │ ├── build │ │ └── temp.macosx-10.9-intel-2.7 │ │ │ └── lear_gist │ │ │ ├── gist.o │ │ │ └── standalone_image.o │ ├── setup.py │ ├── README.txt │ └── PKG-INFO ├── a.jpg ├── a.ppm ├── compute_gist ├── prepare_lsh.py ├── img_gist.py ├── hsv.py ├── lsh.py ├── segment.py ├── prepare_local.py ├── rerank.py ├── img_hog.py ├── img_sift.py ├── hog.py ├── img_histo.py ├── prepare.py └── kmeans.py ├── static ├── dataset │ ├── README.md │ └── ferrari │ │ ├── red │ │ ├── 44070187_5e5a50b675_b.jpg │ │ ├── 1408706779_ef3c0138e8_b.jpg │ │ ├── 2902679383_a00f4c9d27_b.jpg │ │ ├── 3798471501_e21d10e8e5_b.jpg │ │ ├── 3852233337_7593a392c1_b.jpg │ │ ├── 3858731907_ddb22cb07a_b.jpg │ │ ├── 3862801353_58634506b4_b.jpg │ │ ├── 3871539198_7c9eff8d6c_b.jpg │ │ ├── 3908437070_6d1173f47b_b.jpg │ │ ├── 4079607261_3c114d3a8e_b.jpg │ │ ├── 4105670373_07961469ca_b.jpg │ │ ├── 4134432241_27a7fba12e_b.jpg │ │ ├── 4261480774_5e82ea5aab_b.jpg │ │ ├── 4324994685_61be270b04_b.jpg │ │ ├── 4331753151_585be76b68_b.jpg │ │ ├── 4721832011_3de675c983_b.jpg │ │ ├── 4812805891_26529709c4_b.jpg │ │ ├── 5483730934_993957e64d_b.jpg │ │ ├── 5608030160_edd9c359c1_b.jpg │ │ ├── 5643664396_7c47fb12c9_b.jpg │ │ ├── 5688040353_a2823c6b96_b.jpg │ │ ├── 5688598698_c4ec7b367d_b.jpg │ │ ├── 5720090028_b589d5ee8e_b.jpg │ │ ├── 5751134603_33282e19e2_b.jpg │ │ ├── 5766001005_0cfe9473a4_b.jpg │ │ ├── 6176392778_a862c89ea8_b.jpg │ │ ├── 6207978596_ba2af46ac5_b.jpg │ │ ├── 6226663604_9df3b7502d_b.jpg │ │ ├── 6232287311_65a27e54d7_b.jpg │ │ ├── 6243477453_ec5bf236cb_b.jpg │ │ ├── 6253200918_3c2fe895ed_b.jpg │ │ ├── 6631643371_f2bb9c8f24_b.jpg │ │ ├── 6737987079_b515451dce_b.jpg │ │ ├── 6774586903_8d9a8974f2_b.jpg │ │ ├── 6796792481_40c359f8ce_b.jpg │ │ ├── 6822615599_18d9915317_b.jpg │ │ ├── 6840568965_0b388474e7_b.jpg │ │ ├── 3908437070_6d1173f47b_b.xml │ │ ├── 2902679383_a00f4c9d27_b.xml │ │ ├── 6737987079_b515451dce_b.xml │ │ ├── 4261480774_5e82ea5aab_b.xml │ │ ├── 5751134603_33282e19e2_b.xml │ │ ├── 5608030160_edd9c359c1_b.xml │ │ ├── 3852233337_7593a392c1_b.xml │ │ ├── 3862801353_58634506b4_b.xml │ │ ├── 4812805891_26529709c4_b.xml │ │ └── 4105670373_07961469ca_b.xml │ │ ├── black │ │ ├── 2828686873_2fa36f83d7_b.jpg │ │ ├── 2888849442_c672a6ba10_b.jpg │ │ ├── 2911718073_9257a35692_b.jpg │ │ ├── 3053451700_0c24eae7ed_b.jpg │ │ ├── 3144680857_f1bbc74bf4_b.jpg │ │ ├── 3714394095_a28ee188cb_b.jpg │ │ ├── 3799029235_326325c0d5_b.jpg │ │ ├── 3799161183_cce05c6300_b.jpg │ │ ├── 3853040578_7f8a725cff_b.jpg │ │ ├── 3853685157_cd2dd3ab80_b.jpg │ │ ├── 3935506954_d745b3dbd7_b.jpg │ │ ├── 4217100714_29a5fb4dee_b.jpg │ │ ├── 4812143761_1bef15cab8_b.jpg │ │ ├── 4875480073_008a4d174d_b.jpg │ │ ├── 5665995420_726bce2783_b.jpg │ │ ├── 6011433427_cede676575_b.jpg │ │ ├── 6226714304_496944d4cc_b.jpg │ │ ├── 6239294498_2627932e26_b.jpg │ │ ├── 6864401265_b7b37ac522_b.jpg │ │ ├── 3799161183_cce05c6300_b.xml │ │ ├── 3799029235_326325c0d5_b.xml │ │ ├── 6011433427_cede676575_b.xml │ │ ├── 2828686873_2fa36f83d7_b.xml │ │ ├── 2888849442_c672a6ba10_b.xml │ │ ├── 3053451700_0c24eae7ed_b.xml │ │ ├── 6864401265_b7b37ac522_b.xml │ │ ├── 3714394095_a28ee188cb_b.xml │ │ ├── 2911718073_9257a35692_b.xml │ │ ├── 3853685157_cd2dd3ab80_b.xml │ │ ├── 3144680857_f1bbc74bf4_b.xml │ │ └── 3853040578_7f8a725cff_b.xml │ │ ├── white │ │ ├── 3087494913_3e61c79038_b.jpg │ │ ├── 3253301032_1c87bd5f1b_b.jpg │ │ ├── 3749342558_18f4409ed5_b.jpg │ │ ├── 3863563450_db8cb5f947_b.jpg │ │ ├── 3923773857_7079bc46a7_b.jpg │ │ ├── 3924463034_902b7e4f47_b.jpg │ │ ├── 3948788706_735fe4ea7f_b.jpg │ │ ├── 5549464199_dc1fd55b14_b.jpg │ │ ├── 5550000906_9c68670383_b.jpg │ │ ├── 5608028246_19a145c4e3_b.jpg │ │ ├── 5941117635_5a7ae6ef87_b.jpg │ │ ├── 6150526860_fd9cd2c04c_b.jpg │ │ ├── 6198881495_ef1228f138_b.jpg │ │ ├── 6408311433_38e75ff3b8_b.jpg │ │ ├── 6538116347_ed6bff7cff_b.jpg │ │ ├── 6545255463_a83b9f7c40_b.jpg │ │ ├── 6572006743_6e42346e51_b.jpg │ │ ├── 6697816985_cd53f439e1_b.jpg │ │ ├── 6408311433_38e75ff3b8_b.xml │ │ ├── 6545255463_a83b9f7c40_b.xml │ │ ├── 3863563450_db8cb5f947_b.xml │ │ ├── 6538116347_ed6bff7cff_b.xml │ │ ├── 5608028246_19a145c4e3_b.xml │ │ ├── 6572006743_6e42346e51_b.xml │ │ ├── 3087494913_3e61c79038_b.xml │ │ └── 5550000906_9c68670383_b.xml │ │ ├── yellow │ │ ├── 227416776_2dc8b1ec1e_b.jpg │ │ ├── 2826761418_04874d7f57_b.jpg │ │ ├── 2883154610_6d0045fae6_b.jpg │ │ ├── 2934717590_490a5aeac9_b.jpg │ │ ├── 2991213583_a1a410b149_b.jpg │ │ ├── 3554098553_b2bd77c6d9_b.jpg │ │ ├── 3742352153_e623a8c157_b.jpg │ │ ├── 3744005153_78bb835f3f_b.jpg │ │ ├── 3758857727_e098d1bc96_b.jpg │ │ ├── 3759652086_5310743d3a_b.jpg │ │ ├── 3775967976_8f5ef1bfa4_b.jpg │ │ ├── 3937826223_3d6769fe74_b.jpg │ │ ├── 3938602096_0e8d1f20b1_b.jpg │ │ ├── 4135901965_35cf61cef4_b.jpg │ │ ├── 4175517996_6245a0907c_b.jpg │ │ ├── 4187538919_c1320d4ea7_b.jpg │ │ ├── 4356830323_85e00e03f3_b.jpg │ │ ├── 4451720072_d402f28616_b.jpg │ │ ├── 4608953535_59ec97f93a_b.jpg │ │ ├── 4608953767_0f2f054c87_b.jpg │ │ ├── 4718960846_a63298e483_b.jpg │ │ ├── 4720646644_b06a86728f_b.jpg │ │ ├── 4804734303_a36879921b_b.jpg │ │ ├── 4952282992_833ebb47af_b.jpg │ │ ├── 5434338226_eb0755f9d8_b.jpg │ │ ├── 5718148633_85e71969fc_b.jpg │ │ ├── 2991213583_a1a410b149_b.xml │ │ ├── 2826761418_04874d7f57_b.xml │ │ ├── 2934717590_490a5aeac9_b.xml │ │ ├── 4175517996_6245a0907c_b.xml │ │ ├── 3744005153_78bb835f3f_b.xml │ │ ├── 3937826223_3d6769fe74_b.xml │ │ ├── 4451720072_d402f28616_b.xml │ │ ├── 4608953535_59ec97f93a_b.xml │ │ ├── 4608953767_0f2f054c87_b.xml │ │ ├── 4356830323_85e00e03f3_b.xml │ │ ├── 5434338226_eb0755f9d8_b.xml │ │ ├── 227416776_2dc8b1ec1e_b.xml │ │ ├── 3938602096_0e8d1f20b1_b.xml │ │ ├── 4187538919_c1320d4ea7_b.xml │ │ ├── 4720646644_b06a86728f_b.xml │ │ ├── 3554098553_b2bd77c6d9_b.xml │ │ └── 4718960846_a63298e483_b.xml │ │ └── README.txt ├── js │ ├── glyphicons-halflings.png │ ├── glyphicons-halflings-white.png │ └── googleanalytics.js └── upload │ └── 001a2d5efe0d6f32f220483239fd5b4d.jpg ├── urls.py ├── settings.py ├── templates ├── template_base.html └── template_cbir.html ├── main.py ├── conf └── log.conf └── README.md /apps/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/model.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/worker.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/webcategory.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.pyc 3 | -------------------------------------------------------------------------------- /util/pyleargist-2.0.5/VERSION.txt: -------------------------------------------------------------------------------- 1 | 2.0.5 2 | 3 | -------------------------------------------------------------------------------- /util/pyleargist-2.0.5/src/pyleargist.egg-info/dependency_links.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /util/pyleargist-2.0.5/src/pyleargist.egg-info/top_level.txt: -------------------------------------------------------------------------------- 1 | leargist 2 | -------------------------------------------------------------------------------- /util/a.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/util/a.jpg -------------------------------------------------------------------------------- /util/a.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/util/a.ppm -------------------------------------------------------------------------------- /util/compute_gist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/util/compute_gist -------------------------------------------------------------------------------- /static/dataset/README.md: -------------------------------------------------------------------------------- 1 | this dir should include several datasets: simpcity, infochimps, ferrari, mixed. 2 | -------------------------------------------------------------------------------- /util/pyleargist-2.0.5/setup.cfg: -------------------------------------------------------------------------------- 1 | [egg_info] 2 | tag_build = 3 | tag_date = 0 4 | tag_svn_revision = 0 5 | 6 | -------------------------------------------------------------------------------- /util/pyleargist-2.0.5/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include *.txt 2 | recursive-include lear_gist README Makefile *.c *.h ar.ppm 3 | -------------------------------------------------------------------------------- /static/js/glyphicons-halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/js/glyphicons-halflings.png -------------------------------------------------------------------------------- /util/pyleargist-2.0.5/lear_gist/ar.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/util/pyleargist-2.0.5/lear_gist/ar.ppm -------------------------------------------------------------------------------- /static/js/glyphicons-halflings-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/js/glyphicons-halflings-white.png -------------------------------------------------------------------------------- /static/dataset/ferrari/red/44070187_5e5a50b675_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/44070187_5e5a50b675_b.jpg -------------------------------------------------------------------------------- /static/upload/001a2d5efe0d6f32f220483239fd5b4d.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/upload/001a2d5efe0d6f32f220483239fd5b4d.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/red/1408706779_ef3c0138e8_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/1408706779_ef3c0138e8_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/red/2902679383_a00f4c9d27_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/2902679383_a00f4c9d27_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/red/3798471501_e21d10e8e5_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/3798471501_e21d10e8e5_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/red/3852233337_7593a392c1_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/3852233337_7593a392c1_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/red/3858731907_ddb22cb07a_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/3858731907_ddb22cb07a_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/red/3862801353_58634506b4_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/3862801353_58634506b4_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/red/3871539198_7c9eff8d6c_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/3871539198_7c9eff8d6c_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/red/3908437070_6d1173f47b_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/3908437070_6d1173f47b_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/red/4079607261_3c114d3a8e_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/4079607261_3c114d3a8e_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/red/4105670373_07961469ca_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/4105670373_07961469ca_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/red/4134432241_27a7fba12e_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/4134432241_27a7fba12e_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/red/4261480774_5e82ea5aab_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/4261480774_5e82ea5aab_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/red/4324994685_61be270b04_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/4324994685_61be270b04_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/red/4331753151_585be76b68_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/4331753151_585be76b68_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/red/4721832011_3de675c983_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/4721832011_3de675c983_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/red/4812805891_26529709c4_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/4812805891_26529709c4_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/red/5483730934_993957e64d_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/5483730934_993957e64d_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/red/5608030160_edd9c359c1_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/5608030160_edd9c359c1_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/red/5643664396_7c47fb12c9_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/5643664396_7c47fb12c9_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/red/5688040353_a2823c6b96_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/5688040353_a2823c6b96_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/red/5688598698_c4ec7b367d_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/5688598698_c4ec7b367d_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/red/5720090028_b589d5ee8e_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/5720090028_b589d5ee8e_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/red/5751134603_33282e19e2_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/5751134603_33282e19e2_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/red/5766001005_0cfe9473a4_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/5766001005_0cfe9473a4_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/red/6176392778_a862c89ea8_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/6176392778_a862c89ea8_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/red/6207978596_ba2af46ac5_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/6207978596_ba2af46ac5_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/red/6226663604_9df3b7502d_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/6226663604_9df3b7502d_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/red/6232287311_65a27e54d7_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/6232287311_65a27e54d7_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/red/6243477453_ec5bf236cb_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/6243477453_ec5bf236cb_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/red/6253200918_3c2fe895ed_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/6253200918_3c2fe895ed_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/red/6631643371_f2bb9c8f24_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/6631643371_f2bb9c8f24_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/red/6737987079_b515451dce_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/6737987079_b515451dce_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/red/6774586903_8d9a8974f2_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/6774586903_8d9a8974f2_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/red/6796792481_40c359f8ce_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/6796792481_40c359f8ce_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/red/6822615599_18d9915317_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/6822615599_18d9915317_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/red/6840568965_0b388474e7_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/red/6840568965_0b388474e7_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/black/2828686873_2fa36f83d7_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/black/2828686873_2fa36f83d7_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/black/2888849442_c672a6ba10_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/black/2888849442_c672a6ba10_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/black/2911718073_9257a35692_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/black/2911718073_9257a35692_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/black/3053451700_0c24eae7ed_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/black/3053451700_0c24eae7ed_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/black/3144680857_f1bbc74bf4_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/black/3144680857_f1bbc74bf4_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/black/3714394095_a28ee188cb_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/black/3714394095_a28ee188cb_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/black/3799029235_326325c0d5_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/black/3799029235_326325c0d5_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/black/3799161183_cce05c6300_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/black/3799161183_cce05c6300_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/black/3853040578_7f8a725cff_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/black/3853040578_7f8a725cff_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/black/3853685157_cd2dd3ab80_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/black/3853685157_cd2dd3ab80_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/black/3935506954_d745b3dbd7_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/black/3935506954_d745b3dbd7_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/black/4217100714_29a5fb4dee_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/black/4217100714_29a5fb4dee_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/black/4812143761_1bef15cab8_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/black/4812143761_1bef15cab8_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/black/4875480073_008a4d174d_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/black/4875480073_008a4d174d_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/black/5665995420_726bce2783_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/black/5665995420_726bce2783_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/black/6011433427_cede676575_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/black/6011433427_cede676575_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/black/6226714304_496944d4cc_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/black/6226714304_496944d4cc_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/black/6239294498_2627932e26_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/black/6239294498_2627932e26_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/black/6864401265_b7b37ac522_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/black/6864401265_b7b37ac522_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/white/3087494913_3e61c79038_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/white/3087494913_3e61c79038_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/white/3253301032_1c87bd5f1b_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/white/3253301032_1c87bd5f1b_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/white/3749342558_18f4409ed5_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/white/3749342558_18f4409ed5_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/white/3863563450_db8cb5f947_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/white/3863563450_db8cb5f947_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/white/3923773857_7079bc46a7_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/white/3923773857_7079bc46a7_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/white/3924463034_902b7e4f47_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/white/3924463034_902b7e4f47_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/white/3948788706_735fe4ea7f_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/white/3948788706_735fe4ea7f_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/white/5549464199_dc1fd55b14_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/white/5549464199_dc1fd55b14_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/white/5550000906_9c68670383_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/white/5550000906_9c68670383_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/white/5608028246_19a145c4e3_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/white/5608028246_19a145c4e3_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/white/5941117635_5a7ae6ef87_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/white/5941117635_5a7ae6ef87_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/white/6150526860_fd9cd2c04c_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/white/6150526860_fd9cd2c04c_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/white/6198881495_ef1228f138_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/white/6198881495_ef1228f138_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/white/6408311433_38e75ff3b8_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/white/6408311433_38e75ff3b8_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/white/6538116347_ed6bff7cff_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/white/6538116347_ed6bff7cff_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/white/6545255463_a83b9f7c40_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/white/6545255463_a83b9f7c40_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/white/6572006743_6e42346e51_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/white/6572006743_6e42346e51_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/white/6697816985_cd53f439e1_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/white/6697816985_cd53f439e1_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/227416776_2dc8b1ec1e_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/yellow/227416776_2dc8b1ec1e_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/2826761418_04874d7f57_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/yellow/2826761418_04874d7f57_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/2883154610_6d0045fae6_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/yellow/2883154610_6d0045fae6_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/2934717590_490a5aeac9_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/yellow/2934717590_490a5aeac9_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/2991213583_a1a410b149_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/yellow/2991213583_a1a410b149_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/3554098553_b2bd77c6d9_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/yellow/3554098553_b2bd77c6d9_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/3742352153_e623a8c157_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/yellow/3742352153_e623a8c157_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/3744005153_78bb835f3f_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/yellow/3744005153_78bb835f3f_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/3758857727_e098d1bc96_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/yellow/3758857727_e098d1bc96_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/3759652086_5310743d3a_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/yellow/3759652086_5310743d3a_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/3775967976_8f5ef1bfa4_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/yellow/3775967976_8f5ef1bfa4_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/3937826223_3d6769fe74_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/yellow/3937826223_3d6769fe74_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/3938602096_0e8d1f20b1_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/yellow/3938602096_0e8d1f20b1_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/4135901965_35cf61cef4_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/yellow/4135901965_35cf61cef4_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/4175517996_6245a0907c_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/yellow/4175517996_6245a0907c_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/4187538919_c1320d4ea7_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/yellow/4187538919_c1320d4ea7_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/4356830323_85e00e03f3_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/yellow/4356830323_85e00e03f3_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/4451720072_d402f28616_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/yellow/4451720072_d402f28616_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/4608953535_59ec97f93a_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/yellow/4608953535_59ec97f93a_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/4608953767_0f2f054c87_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/yellow/4608953767_0f2f054c87_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/4718960846_a63298e483_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/yellow/4718960846_a63298e483_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/4720646644_b06a86728f_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/yellow/4720646644_b06a86728f_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/4804734303_a36879921b_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/yellow/4804734303_a36879921b_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/4952282992_833ebb47af_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/yellow/4952282992_833ebb47af_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/5434338226_eb0755f9d8_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/yellow/5434338226_eb0755f9d8_b.jpg -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/5718148633_85e71969fc_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/static/dataset/ferrari/yellow/5718148633_85e71969fc_b.jpg -------------------------------------------------------------------------------- /urls.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding: utf-8 3 | from apps import cbir 4 | 5 | urls = [ 6 | (r"/cbir", cbir.MainHandler), 7 | 8 | ] 9 | 10 | -------------------------------------------------------------------------------- /util/pyleargist-2.0.5/build/temp.macosx-10.9-intel-2.7/lear_gist/gist.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/util/pyleargist-2.0.5/build/temp.macosx-10.9-intel-2.7/lear_gist/gist.o -------------------------------------------------------------------------------- /util/pyleargist-2.0.5/build/temp.macosx-10.9-intel-2.7/lear_gist/standalone_image.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/util/pyleargist-2.0.5/build/temp.macosx-10.9-intel-2.7/lear_gist/standalone_image.o -------------------------------------------------------------------------------- /util/pyleargist-2.0.5/lear_gist/compute_gist.dSYM/Contents/Resources/DWARF/compute_gist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyspeed/py-cbir/HEAD/util/pyleargist-2.0.5/lear_gist/compute_gist.dSYM/Contents/Resources/DWARF/compute_gist -------------------------------------------------------------------------------- /static/js/googleanalytics.js: -------------------------------------------------------------------------------- 1 | (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ 2 | (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), 3 | m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) 4 | })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); 5 | 6 | ga('create', 'UA-41922540-1', 'sinaapp.com'); 7 | ga('send', 'pageview'); 8 | -------------------------------------------------------------------------------- /settings.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | import os.path 4 | 5 | demo_port = 19999 6 | 7 | settings = { 8 | "sitename": "CBIR demo", 9 | "template_path": os.path.join(os.path.dirname(__file__), "templates"), 10 | "static_path": os.path.join(os.path.dirname(__file__), "static"), 11 | "xsrf_cookies": False, 12 | "cookie_secret": "23i8ik2KOW9kajf9EW8aJmv0/R4=", 13 | "login_url": "/auth/login", 14 | "autoescape": None, 15 | "debug": True, 16 | } 17 | 18 | db = { 19 | } 20 | -------------------------------------------------------------------------------- /util/pyleargist-2.0.5/src/pyleargist.egg-info/SOURCES.txt: -------------------------------------------------------------------------------- 1 | COPYING.txt 2 | MANIFEST.in 3 | README.txt 4 | VERSION.txt 5 | setup.py 6 | lear_gist/Makefile 7 | lear_gist/README 8 | lear_gist/ar.ppm 9 | lear_gist/compute_gist.c 10 | lear_gist/gist.c 11 | lear_gist/gist.h 12 | lear_gist/standalone_image.c 13 | lear_gist/standalone_image.h 14 | src/leargist.pyx 15 | src/pyleargist.egg-info/PKG-INFO 16 | src/pyleargist.egg-info/SOURCES.txt 17 | src/pyleargist.egg-info/dependency_links.txt 18 | src/pyleargist.egg-info/top_level.txt -------------------------------------------------------------------------------- /util/prepare_lsh.py: -------------------------------------------------------------------------------- 1 | from lsh import * 2 | 3 | def transform(p_in, lsh_func, p_out): 4 | fout = open(p_out, 'w') 5 | for line in open(p_in): 6 | path, s = line.strip().split('\t') 7 | h0 = eval(s) 8 | lsh = lsh_func(h0) 9 | if len(lsh) >= 8: 10 | fout.write('%s\t%s\n' % (path, lsh)) 11 | fout.close() 12 | 13 | if __name__ == '__main__': 14 | #transform('../conf/hog_feat.txt', LSH_hog, '../conf/hog_lsh.txt') 15 | transform('../conf/sift_feat.txt', LSH_sift, '../conf/sift_lsh.txt') 16 | -------------------------------------------------------------------------------- /util/img_gist.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import Image 4 | 5 | cur_path = os.path.abspath(os.path.dirname(__file__)) 6 | 7 | def gist(im): 8 | if not isinstance(im, Image.Image): 9 | im = Image.open(im) 10 | im = im.resize((100, 100), Image.ANTIALIAS).convert('RGB') 11 | im.save('a.ppm') 12 | feats = os.popen(cur_path+'/compute_gist -nblocks 2 -orientationsPerScale 4,4,4 a.ppm').read().strip() 13 | return [float(v) for v in feats.split(' ')] 14 | 15 | def test(): 16 | path = '../static/upload/66ndiy4n5r.png' 17 | print 'gist len:', len(gist(path)) 18 | 19 | if __name__ == '__main__': 20 | test() 21 | -------------------------------------------------------------------------------- /util/pyleargist-2.0.5/lear_gist/Makefile: -------------------------------------------------------------------------------- 1 | # Lear's GIST implementation, version 1.0, (c) INRIA 2009, Licence: GPL 2 | 3 | 4 | all: compute_gist 5 | 6 | WFFTINC= 7 | WFFTLIB= 8 | # WFFTINC=-I/scratch/adonis/mordelet/install/include 9 | # WFFTLIB=-L/scratch/adonis/mordelet/install/lib 10 | 11 | 12 | # gist.c: ../../descriptors/gist.c 13 | # cp $< $@ 14 | 15 | 16 | gist.o: gist.c gist.h standalone_image.h 17 | gcc -c -Wall -g $< $(WFFTINC) -DUSE_GIST -DSTANDALONE_GIST 18 | 19 | standalone_image.o: standalone_image.c standalone_image.h 20 | gcc -c -Wall -g $< 21 | 22 | compute_gist: compute_gist.c gist.o standalone_image.o 23 | gcc -Wall -g -o $@ $^ $(WFFTLIB) -lfftw3f -lm 24 | 25 | 26 | 27 | clean: 28 | rm -f *.o compute_gist 29 | 30 | -------------------------------------------------------------------------------- /templates/template_base.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | {% block head %}{% end %} 10 | 11 | 12 |
13 | 16 |
17 | {% block body %}{% end %} 18 |
19 |
20 | {% block bottom %}{% end %} 21 | 22 | 23 | -------------------------------------------------------------------------------- /util/pyleargist-2.0.5/lear_gist/compute_gist.dSYM/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleIdentifier 8 | com.apple.xcode.dsym.compute_gist 9 | CFBundleInfoDictionaryVersion 10 | 6.0 11 | CFBundlePackageType 12 | dSYM 13 | CFBundleSignature 14 | ???? 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleVersion 18 | 1 19 | 20 | 21 | -------------------------------------------------------------------------------- /util/hsv.py: -------------------------------------------------------------------------------- 1 | import Image, colorsys 2 | def convert2hsv(im): 3 | if not isinstance(im, Image.Image): 4 | im = Image.open(im) 5 | im = im.convert('RGB') 6 | R, G, B = im.split() 7 | H, L, S = [], [], [] 8 | for r, g, b in zip(R.getdata(), G.getdata(), B.getdata()): 9 | h, l, s = colorsys.rgb_to_hls(r/255., g/255., b/255.) 10 | H.append(int(h*255.)) 11 | L.append(int(l*255.)) 12 | S.append(int(s*255.)) 13 | R.putdata(H) 14 | G.putdata(L) 15 | B.putdata(S) 16 | return Image.merge('RGB', (R, G, B)) 17 | 18 | def test(): 19 | path = '../static/dataset/simpcity/0.jpg' 20 | im = Image.open(path) 21 | im.show() 22 | im2 = convert2hsv(im) 23 | im2.show() 24 | 25 | if __name__ == '__main__': 26 | test() 27 | 28 | 29 | -------------------------------------------------------------------------------- /util/lsh.py: -------------------------------------------------------------------------------- 1 | from numpy import array, floor 2 | 3 | def idx_hog(p): 4 | p2 = [(c,v) for c, v in enumerate(p)] 5 | sort_list = sorted(p2, key=lambda d:d[1], reverse=True) 6 | p3 = ['%02d%02d' % (c, int(v*50)) for c, v in sort_list[:5] if v > 0.02] 7 | #p3 = ['%02d%02d' % (c, int(v*25)) for c, v in sort_list[:9] if v > 0.01] 8 | return ''.join(p3) 9 | 10 | def LSH_hog(h0): 11 | p_list = [h0[i*0:i*0+9] for i in range(4)] 12 | idx_list = [idx_hog(p) for p in p_list] 13 | return ''.join(idx_list) 14 | 15 | def idx_sift(p): 16 | p2 = [(c,v) for c, v in enumerate(p)] 17 | sort_list = sorted(p2, key=lambda d:d[1], reverse=True) 18 | p3 = ['%02d%02d' % (c, int(v*0)) for c, v in sort_list[:4] if v > 0.02] 19 | return ''.join(p3) 20 | 21 | def LSH_sift(h0): 22 | idx_list = idx_sift(h0) 23 | return ''.join(idx_list) 24 | 25 | -------------------------------------------------------------------------------- /util/segment.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import os 3 | import sys 4 | import glob 5 | import Image 6 | import math 7 | from img_hash import avg, update 8 | 9 | class MRFSegmenter(object): 10 | def __init__(self): 11 | pass 12 | 13 | def init(self, im): 14 | if not isinstance(im, Image.Image): 15 | im = Image.open(im) 16 | im = im.resize((100, 100), Image.ANTIALIAS) 17 | im.show() 18 | im2 = im.convert('L') 19 | avg = reduce(lambda x, y: x + y, im2.getdata()) / 10000. 20 | for x in range(100): 21 | for y in range(100): 22 | if im2.getpixel((x, y)) > avg: 23 | im2.putpixel((x, y), 255) 24 | else: 25 | im2.putpixel((x, y), 0) 26 | im2.show() 27 | 28 | 29 | def test(): 30 | path = '../static/dataset/simpcity/1.jpg' 31 | #seg = MRFSegmenter() 32 | #seg.init(path) 33 | 34 | if __name__ == '__main__': 35 | test() 36 | 37 | -------------------------------------------------------------------------------- /static/dataset/ferrari/README.txt: -------------------------------------------------------------------------------- 1 | README for the Ferrari test data set 2 | ==================================== 3 | 4 | Author: Dr. Mathias Lux, mlux@itec.uni-klu.ac.at 5 | Date: 2012-02-28 6 | License: Attribution-ShareAlike License 7 | http://creativecommons.org/licenses/by-sa/2.0/ 8 | 9 | The test data set contains 100 images of sports cars downloaded from 10 | Flickr. For each photo an XML file exists, where you can find all the 11 | metadata available on the web page. All photos are licensed either with 12 | the attribution creative commons license or a free to use license. You 13 | can find the license type as well as the attribution in the XML files. 14 | 15 | license 4: Attribution License, 16 | http://creativecommons.org/licenses/by/2.0/ 17 | license 5: Attribution-ShareAlike License, 18 | http://creativecommons.org/licenses/by-sa/2.0/ 19 | license 7: No known copyright restrictions, 20 | http://flickr.com/commons/usage/ 21 | 22 | The images have been classified based on the color of the car depicted. 23 | Classification can be inferred from the sub directories names. -------------------------------------------------------------------------------- /util/pyleargist-2.0.5/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | from setuptools.extension import Extension 3 | #from Cython.Distutils import build_ext 4 | import sys, os 5 | import numpy as np 6 | 7 | version = file('VERSION.txt').read().strip() 8 | 9 | setup(name='pyleargist', 10 | version=version, 11 | description="GIST Image descriptor for scene recognition", 12 | long_description=file('README.txt').read(), 13 | classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers 14 | keywords=('image-processing computer-vision scene-recognition'), 15 | author='Olivier Grisel', 16 | author_email='olivier.grisel@ensta.org', 17 | url='http://www.bitbucket.org/ogrisel/pyleargist/src/tip/', 18 | license='PSL', 19 | package_dir={'': 'src'}, 20 | #cmdclass = {"build_ext": build_ext}, 21 | ext_modules=[ 22 | Extension( 23 | 'leargist', [ 24 | 'lear_gist/standalone_image.c', 25 | 'lear_gist/gist.c', 26 | 'src/leargist.pyx', 27 | ], 28 | libraries=['m', 'fftw3f'], 29 | include_dirs=[np.get_include(), 'lear_gist',], 30 | extra_compile_args=['-DUSE_GIST', '-DSTANDALONE_GIST'], 31 | ), 32 | ], 33 | ) 34 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding: utf-8 3 | import os 4 | import sys 5 | reload(sys) 6 | sys.setdefaultencoding('utf-8') 7 | import platform 8 | cur_platform = platform.platform() 9 | if cur_platform.startswith('Linux'): 10 | sys.path.append('/home/michael/install/py_public') 11 | else: 12 | sys.path.append('/Users/zuotaoliu/install/py_public') 13 | 14 | from tornado.options import define, options 15 | import tornado.web 16 | import tornado.httpserver 17 | import tornado.ioloop 18 | import traceback 19 | 20 | from urls import urls 21 | from settings import settings, demo_port 22 | 23 | import logging 24 | import logging.config 25 | cur_path = os.path.dirname(__file__) 26 | log_conf_file = os.path.join(cur_path, './conf/log.conf') 27 | logging.config.fileConfig(log_conf_file) 28 | ilog = logging.getLogger('root') 29 | 30 | define("port", default=demo_port, help="run one the given port", type=int) 31 | 32 | def main(): 33 | try: 34 | tornado.options.parse_command_line() 35 | application = tornado.web.Application(urls, **settings) 36 | http_server = tornado.httpserver.HTTPServer(application) 37 | http_server.listen(options.port) 38 | tornado.ioloop.IOLoop.instance().start() 39 | except Exception as e: 40 | tb = traceback.format_exc().replace('\n', '') 41 | print 'tornado server failed: %s' % (tb) 42 | 43 | if __name__ == "__main__": 44 | main() 45 | 46 | -------------------------------------------------------------------------------- /conf/log.conf: -------------------------------------------------------------------------------- 1 | [loggers] 2 | keys=root,worker,model 3 | 4 | [handlers] 5 | keys=wcoLog,workerLog,modelLog 6 | 7 | [formatters] 8 | keys=wcoLog,workerLog,modelLog 9 | 10 | [logger_root] 11 | handlers=wcoLog 12 | level=DEBUG 13 | qualname=wco 14 | propagate=1 15 | 16 | [logger_worker] 17 | handlers=workerLog 18 | level=DEBUG 19 | qualname=wco 20 | propagate=1 21 | 22 | [logger_model] 23 | handlers=modelLog 24 | level=DEBUG 25 | qualname=wco 26 | propagate=1 27 | 28 | [handler_wcoLog] 29 | class = logging.handlers.TimedRotatingFileHandler 30 | level = DEBUG 31 | formatter = wcoLog 32 | args=(os.path.join(os.path.abspath('./logs/'), 'webcategory.log'), 'D') 33 | [formatter_wcoLog] 34 | format = %(name)s %(levelname)s %(filename)s:%(lineno)s %(asctime)s %(process)d:%(thread)d %(message)s 35 | 36 | [handler_workerLog] 37 | class = logging.handlers.TimedRotatingFileHandler 38 | level = DEBUG 39 | formatter = workerLog 40 | args=(os.path.join(os.path.abspath('./logs/'), 'worker.log'), 'D') 41 | [formatter_workerLog] 42 | format = %(name)s %(levelname)s %(filename)s:%(lineno)s %(asctime)s %(process)d:%(thread)d %(message)s 43 | 44 | [handler_modelLog] 45 | class = logging.handlers.TimedRotatingFileHandler 46 | level = DEBUG 47 | formatter = modelLog 48 | args=(os.path.join(os.path.abspath('./logs/'), 'model.log'), 'D') 49 | [formatter_modelLog] 50 | format = %(name)s %(levelname)s %(filename)s:%(lineno)s %(asctime)s %(process)d:%(thread)d %(message)s 51 | 52 | -------------------------------------------------------------------------------- /util/pyleargist-2.0.5/lear_gist/standalone_image.h: -------------------------------------------------------------------------------- 1 | /* Lear's GIST implementation, version 1.0, (c) INRIA 2009, Licence: GPL */ 2 | 3 | 4 | 5 | #ifndef STANDALONE_IMAGE_H 6 | #define STANDALONE_IMAGE_H 7 | 8 | /**************************************************************************** 9 | * Image structures 10 | */ 11 | 12 | 13 | 14 | typedef struct { 15 | int width,height; /* dimensions */ 16 | int stride; /* width of image in memory */ 17 | 18 | float *data; /* data in latin reading order */ 19 | } image_t; 20 | 21 | typedef struct { 22 | int width,height; /* here, stride = width */ 23 | 24 | float *c1; /* R */ 25 | float *c2; /* G */ 26 | float *c3; /* B */ 27 | 28 | } color_image_t; 29 | 30 | image_t *image_new(int width, int height); 31 | 32 | image_t *image_cpy(image_t *src); 33 | 34 | void image_delete(image_t *image); 35 | 36 | 37 | color_image_t *color_image_new(int width, int height); 38 | 39 | color_image_t *color_image_cpy(color_image_t *src); 40 | 41 | void color_image_delete(color_image_t *image); 42 | 43 | 44 | typedef struct { 45 | int size; /* Number of images in the list */ 46 | int alloc_size; /* Number of allocated images */ 47 | 48 | image_t **data; /* List of images */ 49 | 50 | } image_list_t; 51 | 52 | 53 | image_list_t *image_list_new(void); 54 | 55 | void image_list_append(image_list_t *list, image_t *image); 56 | 57 | void image_list_delete(image_list_t *list); 58 | 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /util/pyleargist-2.0.5/lear_gist/gist.h: -------------------------------------------------------------------------------- 1 | /* Lear's GIST implementation, version 1.0, (c) INRIA 2009, Licence: GPL */ 2 | 3 | 4 | #ifndef GIST_H_INCLUDED 5 | #define GIST_H_INCLUDED 6 | 7 | 8 | #include "standalone_image.h" 9 | 10 | 11 | /*! Graylevel GIST for various scales. Based on Torralba's Matlab 12 | * implementation. http://people.csail.mit.edu/torralba/code/spatialenvelope/ 13 | * 14 | * Descriptor size is w*w*sum(n_orientations[i],i=0..n_scale-1) 15 | * 16 | * @param src Source image 17 | * @param w Number of bins in x and y axis 18 | */ 19 | 20 | float *bw_gist_scaletab(image_t *src, int nblocks, int n_scale, const int *n_orientations); 21 | 22 | /*! @brief implementation of grayscale GIST descriptor. 23 | * Descriptor size is w*w*(a+b+c) 24 | * 25 | * @param src Source image 26 | * @param w Number of bins in x and y axis 27 | */ 28 | float *bw_gist(image_t *scr, int nblocks, int a, int b, int c); 29 | 30 | /*! @brief implementation of color GIST descriptor. 31 | * 32 | * @param src Source image 33 | * @param w Number of bins in x and y axis 34 | */ 35 | float *color_gist(color_image_t *src, int nblocks, int a, int b, int c); 36 | 37 | /*! Color GIST for various scales. Based on Torralba's Matlab 38 | * implementation. http://people.csail.mit.edu/torralba/code/spatialenvelope/ */ 39 | 40 | float *color_gist_scaletab(color_image_t *src, int nblocks, int n_scale, const int *n_orientations); 41 | 42 | void free_desc(float *d); 43 | 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Demo of Content Based Image Retrieval, implemented by Python and Tornado. 2 | 3 | ## Image descriptors 4 | 5 | * perceptual hash 6 | * Otsu's method 7 | * gray/RGB/YUV/HSV histograms 8 | * GIST 9 | * HoG and LSH (built by Kmeans clustering) 10 | * SIFT and LSH (built by Kmeans clustering) 11 | * Dense SIFT 12 | 13 | ## Distance functions 14 | 15 | * Hamming distance, or norm0 distance (L0) 16 | * abs distance (L1) 17 | * Eculidean distance (L2) 18 | 19 | ## Simple re-ranking 20 | 21 | * blending: mix results 22 | * ensembling: weighted sum 23 | 24 | ## Code structure 25 | 26 | * util/: feature descriptors, feature and LSH preparation 27 | * app/: http server, matching and retrieval 28 | * templates/: html templates 29 | * static/: datasets, js, css 30 | * conf/: log.conf, and for feature data 31 | * logs/: for log data 32 | * settings.py: http port, common setting 33 | * urls.py: server url path 34 | 35 | ## Dependencies 36 | 37 | * Tornado 38 | * Image 39 | * numpy, scipy 40 | 41 | ## Run (Linux or Mac) 42 | 43 | * `cd util/pyleargist-2.0.5/lear_gist/ && make && cp compute_gist ../../ && cd -` 44 | * `cd util && python prepare.py && cd -` 45 | * `python main.py` 46 | * access http://localhost:19999/cbir 47 | 48 | ## How to change dataset 49 | 50 | * add a new image folder in static/dataset/ 51 | * in util/prepare.py, change dataset to the folder name, like `dataset = 'ferrari'` 52 | * run as previous section 53 | 54 | ## Author 55 | 56 | Any question, please contact: Zuotao Liu(zuotaoliu@126.com) 57 | 58 | -------------------------------------------------------------------------------- /util/prepare_local.py: -------------------------------------------------------------------------------- 1 | import os 2 | import math 3 | import random 4 | import copy 5 | from scipy import misc 6 | from img_hash import EXTS 7 | from img_hog import hog2, hog_histo 8 | from img_sift import sift2 9 | from kmeans import kmeans, kmeans_classify, load_centers 10 | 11 | class Prepare(object): 12 | def __init__(self): 13 | self.centers = [] 14 | 15 | def prepare(self, set_name, func, p_out): 16 | f_out = open(p_out, 'w') 17 | relative_path = '../static/dataset/%s' % set_name 18 | idx = 0 19 | for f in os.listdir(relative_path): 20 | print 'processing %d...' % idx 21 | idx += 1 22 | full_path = relative_path + '/' + f 23 | postfix = f.split('.')[-1] 24 | if postfix in EXTS: 25 | try: 26 | F = func(full_path) 27 | for feat in F: 28 | f_out.write('static/dataset/%s/%s\t%s\n' % (set_name, f, repr(list(feat)))) 29 | except Exception, e: 30 | print 'Exception:', repr(e) 31 | print 'img path:', full_path 32 | f_out.close() 33 | 34 | 35 | if __name__ == '__main__': 36 | prep = Prepare() 37 | dataset = 'infochimps' 38 | prep.prepare(dataset, hog2, '../conf/hog_feat2.txt') 39 | #kmeans('../conf/hog_feat.txt', '../conf/hog_kmeans.txt', nclass=100, max_iter=20, percent=0.5) 40 | 41 | #prep.prepare(dataset, sift2, '../conf/sift_feat.txt') 42 | #kmeans('../conf/sift_feat.txt', '../conf/sift_kmeans.txt', nclass=100, max_iter=20, percent=0.5) 43 | 44 | -------------------------------------------------------------------------------- /templates/template_cbir.html: -------------------------------------------------------------------------------- 1 | {% extends "template_base.html" %} 2 | 3 | {% block head %} 4 | {{ escape("CBIR demo") }} 5 | 7 | {% end %} 8 | 9 | {% block nav %} 10 |
11 | 14 | {% end %} 15 | 16 | {% block body %} 17 |

CBIR demo

18 |
19 |
20 | 21 | 22 |
23 |
24 |
25 | {% if imgpath %} 26 | 27 | {% end %} 28 |
29 |

{{ err_msg }}

30 |
31 |
32 |
33 | {% for i in range(len(lists)) %} 34 |
35 | {{ lists[i][0] }}: 36 | {% for path, dist in lists[i][1] %} 37 |
38 | 39 | {{ dist }} 40 |
41 | {% end %} 42 |
43 | {% if i%6==3 %} 44 |
45 |
46 | {% end %} 47 | {% end %} 48 |
49 |
50 |
51 | {% end %} 52 | 53 | {% block bottom %} 54 | {% end %} 55 | 56 | -------------------------------------------------------------------------------- /util/rerank.py: -------------------------------------------------------------------------------- 1 | #encoding: utf-8 2 | import copy 3 | 4 | def blending(result_lists, max_len=5, max_weight=-1): 5 | ''' 6 | result_lists: [(list, list_weight)] 7 | ''' 8 | mixed_dict = {} 9 | for result_list, list_weight in result_lists: 10 | for path, weight in result_list: 11 | if path not in mixed_dict: 12 | mixed_dict[path] = weight * list_weight 13 | else: 14 | mixed_dict[path] = min(weight * list_weight, mixed_dict[path]) 15 | sort_list = sorted(mixed_dict.items(), key=lambda d:d[1]) 16 | result_list = [] 17 | for k, v in sort_list[:max_len]: 18 | if max_weight < 0 or v <= max_weight: 19 | result_list.append((k, v)) 20 | return result_list 21 | 22 | 23 | def ensembling(result_lists, max_len=5, max_weight=-1): 24 | ''' 25 | result_lists: [(list, list_weight)] 26 | ''' 27 | default_list = [] 28 | for result_list, list_weight in result_lists: 29 | default_weight = -1 30 | for path, weight in result_list: 31 | if weight * list_weight > default_weight: 32 | default_weight = weight * list_weight * 1.5 33 | default_list.append(default_weight) 34 | mixed_dict = {} 35 | for i, list_pair in enumerate(result_lists): 36 | result_list, list_weight = list_pair 37 | for path, weight in result_list: 38 | if path not in mixed_dict: 39 | mixed_dict[path] = copy.deepcopy(default_list) 40 | mixed_dict[path][i] = weight * list_weight 41 | for path in mixed_dict: 42 | mixed_dict[path] = sum(mixed_dict[path]) 43 | sort_list = sorted(mixed_dict.items(), key=lambda d:d[1]) 44 | result_list = [] 45 | for k, v in sort_list[:max_len]: 46 | if max_weight < 0 or v <= max_weight: 47 | result_list.append((k, v)) 48 | return result_list 49 | -------------------------------------------------------------------------------- /util/img_hog.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import Image 4 | from hog import hog 5 | from kmeans import kmeans, kmeans_classify, load_centers 6 | from lsh import LSH_hog 7 | 8 | cur_path = os.path.abspath(os.path.dirname(__file__)) 9 | center_path = os.path.join(cur_path, '../conf/hog_kmeans.txt') 10 | 11 | centers = None 12 | 13 | def hog2(im): 14 | if not isinstance(im, Image.Image): 15 | im = Image.open(im) 16 | im = im.resize((100, 100), Image.ANTIALIAS).convert('RGB') 17 | im.save('a.jpg') 18 | F = hog('a.jpg') 19 | feat_list = [] 20 | for fs in F: 21 | for f in fs: 22 | feat_list.append(list(f)) 23 | return feat_list 24 | 25 | def hog3(im): 26 | if not isinstance(im, Image.Image): 27 | im = Image.open(im) 28 | im = im.resize((100, 100), Image.ANTIALIAS).convert('RGB') 29 | im.save('a.jpg') 30 | F = hog('a.jpg') 31 | feat_list = [] 32 | for i, fs in enumerate(F): 33 | if i % 2 == 1: continue 34 | for j, f in enumerate(fs): 35 | if j % 2 == 1: continue 36 | feat_list.append(list(f)) 37 | return feat_list 38 | 39 | def hog_lsh_list(im): 40 | feat_list = hog3(im) 41 | F = [] 42 | for feat in feat_list: 43 | lsh = LSH_hog(feat) 44 | F.append(lsh) 45 | return F 46 | 47 | def hog_histo(im, p_centers=center_path): 48 | global centers 49 | if centers == None: 50 | centers = load_centers(p_centers) 51 | F = hog2(im) 52 | histo = {} 53 | for feat in F: 54 | c = kmeans_classify(centers, feat) 55 | histo[c] = histo.get(c, 0) + 1 56 | return [histo.get(c, 0) for c in range(len(centers))] 57 | 58 | 59 | def test(): 60 | full_path = '../../dataset/lena.png' 61 | feat = hog2(full_path) 62 | print len(feat), len(feat[0]) 63 | feat = hog3(full_path) 64 | print len(feat), len(feat[0]) 65 | histo = hog_histo(full_path) 66 | print histo 67 | 68 | if __name__ == '__main__': 69 | test() 70 | 71 | -------------------------------------------------------------------------------- /static/dataset/ferrari/black/3799161183_cce05c6300_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | Ferrari 599 GTB Fiorano. 9 | Sneaky 599. 2nd one of the day - first was dark blue, This car lead me to the SLR. 10 | 11 | 12 | 13 | 14 | 15 | 5 16 | 17 | 18 | 19 | ferrari 20 | 599 21 | fiorano 22 | gtb 23 | black 24 | nero 25 | 26 | 27 | http://www.flickr.com/photos/damianmorysfotos/3799161183/ 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /static/dataset/ferrari/red/3908437070_6d1173f47b_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | CARdid - Ferrari 9 | 10 | 11 | 12 | 13 | 14 | 15 | 36 16 | 17 | 18 | 19 | ferrari 20 | roadcandid 21 | 22 | car 23 | sportscar 24 | red 25 | merah 26 | 27 | 28 | 29 | http://www.flickr.com/photos/emrank/3908437070/ 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /util/img_sift.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import numpy as np 4 | from scipy import misc 5 | from dsift import DsiftExtractor, SingleSiftExtractor 6 | from kmeans import kmeans, kmeans_classify, load_centers 7 | from lsh import LSH_sift 8 | 9 | #gridSpacing: the spacing for sampling dense descriptors 10 | #patchSize: the size for each sift patch 11 | #nrml_thres: low contrast normalization threshold 12 | #sigma_edge: the standard deviation for the gaussian smoothing the standard deviation for the gaussian smoothing 13 | #sift_thres: sift thresholding (0.2 works well based on Lowe's SIFT paper 14 | extractor = DsiftExtractor(12, 24, 1, 0.8, 0.1) 15 | extractor2 = SingleSiftExtractor(24, 1, 0.8, 0.2) 16 | 17 | cur_path = os.path.abspath(os.path.dirname(__file__)) 18 | center_path = os.path.join(cur_path, '../conf/sift_kmeans.txt') 19 | 20 | centers = None 21 | 22 | def sift(im): 23 | if not isinstance(im, np.ndarray): 24 | im = misc.imread(im) 25 | F, P = extractor.process_image(im) 26 | return F 27 | 28 | def sift2(im): 29 | if not isinstance(im, np.ndarray): 30 | im = misc.imread(im) 31 | F = extractor2.process_image(im) 32 | F2 = [] 33 | for f in F: 34 | F2.append(list(f)) 35 | return F2 36 | 37 | def sift_lsh_list(im): 38 | feat_list = sift2(im) 39 | F = [] 40 | for feat in feat_list: 41 | lsh = LSH_sift(feat) 42 | F.append(lsh) 43 | return F 44 | 45 | def sift_histo(im, p_centers=center_path): 46 | global centers 47 | if centers == None: 48 | centers = load_centers(p_centers) 49 | F = sift2(im) 50 | histo = {} 51 | for feat in F: 52 | c = kmeans_classify(centers, feat) 53 | histo[c] = histo.get(c, 0) + 1 54 | return [histo.get(c, 0) for c in range(len(centers))] 55 | 56 | def test(): 57 | full_path = '../../dataset/lena.png' 58 | feat = sift(full_path) 59 | print len(feat), len(feat[0]) 60 | feat = sift2(full_path) 61 | print len(feat), len(feat[0]) 62 | histo = sift_histo(full_path) 63 | print histo 64 | 65 | if __name__ == '__main__': 66 | test() 67 | -------------------------------------------------------------------------------- /util/hog.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | from scipy import misc 3 | from scipy import sqrt, pi, arctan2, cos, sin 4 | from scipy.ndimage import uniform_filter 5 | 6 | def hog(image, orientations=9, pixels_per_cell=(9,9), cells_per_block=(2,2), normalise=True): 7 | if not isinstance(image, np.ndarray): 8 | image = misc.imread(image) 9 | image = np.atleast_2d(image) 10 | if image.ndim >= 3: 11 | image = np.mean(image, 2) 12 | if normalise: # gamma 13 | image = sqrt(image) 14 | if image.dtype.kind == 'u': 15 | image = image.astype('float') 16 | 17 | gx = np.zeros(image.shape) 18 | gy = np.zeros(image.shape) 19 | gx[:, 1:-1] = np.diff(image, n=2, axis=1) 20 | gy[1:-1, :] = np.diff(image, n=2, axis=0) 21 | 22 | magnitude = sqrt(gx**2 + gy**2) 23 | orientation = arctan2(gy, (gx + 1e-15)) * (180 / pi) % 180 24 | 25 | sy, sx = image.shape 26 | cx, cy = pixels_per_cell 27 | bx, by = cells_per_block 28 | 29 | n_cellsx = int(np.floor(sx // cy)) 30 | n_cellsy = int(np.floor(sy // cy)) 31 | 32 | orientation_histogram = np.zeros((n_cellsy, n_cellsx, orientations)) 33 | subsample = np.index_exp[cy/2:cy*n_cellsy:cy, cx/2:cx*n_cellsx:cx] 34 | for i in range(orientations): 35 | temp_ori = np.where(orientation < 180 / orientations * (i+1), orientation, -1) 36 | temp_ori = np.where(orientation >= 180 / orientations * i, temp_ori, -1) 37 | cond2 = temp_ori > -1 38 | temp_mag = np.where(cond2, magnitude, 0) 39 | 40 | temp_filt = uniform_filter(temp_mag, size=(cy, cx)) 41 | orientation_histogram[:,:,i] = temp_filt[subsample] 42 | 43 | n_blocksx = (n_cellsx - bx) + 1 44 | n_blocksy = (n_cellsy - by) + 1 45 | normalised_blocks = np.zeros((n_blocksy, n_blocksx, by*bx*orientations)) 46 | 47 | for x in range(n_blocksx): 48 | for y in range(n_blocksy): 49 | block = orientation_histogram[y:y+by, x:x+bx, :] 50 | eps = 1e-5 51 | block = block / sqrt(block.sum() ** 2 + eps) 52 | normalised_blocks[y, x, :] = block.ravel() 53 | return normalised_blocks 54 | 55 | 56 | -------------------------------------------------------------------------------- /util/pyleargist-2.0.5/lear_gist/README: -------------------------------------------------------------------------------- 1 | 2 | 3 | What is this 4 | ============ 5 | 6 | This is a library and an exectuable that reimplement A. Torralba's 7 | GIST image descriptor in C. The original Matlab implementation is 8 | here: 9 | 10 | http://people.csail.mit.edu/torralba/code/spatialenvelope/ 11 | 12 | How to compile 13 | ============== 14 | 15 | The library depends on fftw3. It is available at: 16 | 17 | http://www.fftw.org/ 18 | 19 | or along with your Linux distribution. Versions 3.1.2 and 3.2.1 work. 20 | 21 | If it is installed in a non-standard location, set the WFFTINC and 22 | WFFTLIB accordingly in the Makefile. 23 | 24 | The code compiles on linux 32 and 64 bit with gcc 4.2.1. It has not 25 | been tested on other platforms. 26 | 27 | How to test 28 | =========== 29 | 30 | The library comes with a mini-executable that computes the GIST 31 | descriptor of a PPM image. To test: 32 | 33 | ./compute_gist ar.ppm 34 | 35 | Should display 960 float values that start with: 36 | 37 | 0.0579 0.1926 0.0933 0.0662 .... 38 | 39 | and end with 40 | 41 | .... 0.0563 0.0575 0.0640 42 | 43 | The code works on non-square images, but it is of little interest: 44 | descriptors computed on images of different sizes are not comparable. 45 | 46 | The library should compute the exact same descriptor as the Matlab 47 | version. Be careful that encoding a small image in JPEG (even with the 48 | maximum quality factor) changes the descriptor. 49 | 50 | Quizz: where does the ar.ppm test image come from? 51 | 52 | Who made it 53 | =========== 54 | 55 | The library was developed in 2009 in the Lear group at INRIA. It was 56 | used in 57 | 58 | @INPROCEEDINGS{JDSAS09, 59 | author = {Matthijs Douze and Herve Jegou and Harsimrat Singh and Laurent Amsaleg 60 | and Cordelia Schmid}, 61 | title = {Evaluation of GIST descriptors for web-scale image search}, 62 | booktitle = {civr}, 63 | year = {2009}, 64 | } 65 | 66 | Licence: GPL 67 | 68 | Comments, complaints to: matthijs.douze@inria.fr 69 | 70 | History 71 | ======= 72 | 73 | jan 2009: Reimplementation of GIST added to Lear's internal image 74 | processing library by Christophe Smekens. 75 | 76 | jul 2009: Standalone version packaged by Matthijs Douze 77 | 78 | 79 | -------------------------------------------------------------------------------- /util/img_histo.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import Image 3 | from hsv import convert2hsv 4 | 5 | normalize = lambda x: [float(v)/sum(x) for v in x] 6 | sample = lambda x: [sum(x[i:i+4]) for i in xrange(0, 255, 4)] 7 | 8 | n_bin = 8 9 | bin_size = 32 10 | 11 | def gray_histo(im): 12 | if not isinstance(im, Image.Image): 13 | im = Image.open(im) 14 | #im = im.resize((200, 200), Image.ANTIALIAS).convert('L') 15 | im = im.convert('L') 16 | histo = im.histogram() 17 | return normalize(sample(histo)) 18 | 19 | def gothrough_img(im, binsize=64): 20 | w, h = im.size 21 | for x in range(w): 22 | for y in range(h): 23 | p = im.getpixel((x, y)) 24 | r, g, b = p[0]/binsize, p[1]/binsize, p[2]/binsize 25 | s = 256 / binsize 26 | yield r * s**2 + g * s + b 27 | 28 | def stat(v_list, v_len=64): 29 | histo = [0] * v_len 30 | for x in v_list: 31 | histo[x] += 1 32 | return histo 33 | 34 | def rgb_histo(im): 35 | if not isinstance(im, Image.Image): 36 | im = Image.open(im) 37 | #im = im.resize((200, 200), Image.ANTIALIAS).convert('RGB') 38 | im = im.convert('RGB') 39 | v_list = gothrough_img(im, bin_size) 40 | return normalize(stat(v_list, n_bin**3)) 41 | 42 | def yuv_histo(im): 43 | if not isinstance(im, Image.Image): 44 | im = Image.open(im) 45 | #im = im.resize((200, 200), Image.ANTIALIAS).convert('YCbCr') 46 | im = im.convert('YCbCr') 47 | v_list = gothrough_img(im, bin_size) 48 | return normalize(stat(v_list, n_bin**3)) 49 | 50 | def hsv_histo(im): 51 | if not isinstance(im, Image.Image): 52 | im = Image.open(im) 53 | #im = im.resize((200, 200), Image.ANTIALIAS).convert('RGB') 54 | im = im.convert('RGB') 55 | im = convert2hsv(im) 56 | v_list = gothrough_img(im, bin_size) 57 | return normalize(stat(v_list, n_bin**3)) 58 | 59 | def abs_dist(h1, h2): 60 | h = sum([abs(h1[i]-h2[i]) for i in range(len(h1))]) 61 | return h 62 | 63 | 64 | def test(): 65 | path = '../static/upload/66ndiy4n5r.png' 66 | path = '../static/dataset/simpcity/0.jpg' 67 | print gray_histo(path) 68 | print rgb_histo(path) 69 | print yuv_histo(path) 70 | print hsv_histo(path) 71 | 72 | if __name__ == '__main__': 73 | test() 74 | -------------------------------------------------------------------------------- /util/pyleargist-2.0.5/lear_gist/standalone_image.c: -------------------------------------------------------------------------------- 1 | /* Lear's GIST implementation, version 1.0, (c) INRIA 2009, Licence: GPL */ 2 | #include 3 | #include 4 | 5 | 6 | #include "standalone_image.h" 7 | 8 | #define NEWA(type,n) (type*)malloc(sizeof(type)*(n)) 9 | #define NEW(type) NEWA(type,1) 10 | 11 | image_t *image_new(int width, int height) { 12 | image_t *im=NEW(image_t); 13 | im->width=im->stride=width; 14 | im->height=height; 15 | int wh=width*height; 16 | im->data=NEWA(float,wh); 17 | return im; 18 | } 19 | 20 | image_t *image_cpy(image_t *src) { 21 | image_t *im=image_new(src->width,src->height); 22 | memcpy(im->data,src->data,sizeof(*(src->data))*src->width*src->height); 23 | return im; 24 | } 25 | 26 | void image_delete(image_t *im) { 27 | free(im->data); 28 | free(im); 29 | } 30 | 31 | 32 | color_image_t *color_image_new(int width, int height) { 33 | color_image_t *im=NEW(color_image_t); 34 | im->width=width; 35 | im->height=height; 36 | int wh=width*height; 37 | im->c1=NEWA(float,wh); 38 | im->c2=NEWA(float,wh); 39 | im->c3=NEWA(float,wh); 40 | return im; 41 | } 42 | 43 | color_image_t *color_image_cpy(color_image_t *src) { 44 | color_image_t *im=color_image_new(src->width,src->height); 45 | memcpy(im->c1,src->c1,sizeof(*(src->c1))*src->width*src->height); 46 | memcpy(im->c2,src->c2,sizeof(*(src->c1))*src->width*src->height); 47 | memcpy(im->c3,src->c3,sizeof(*(src->c1))*src->width*src->height); 48 | return im; 49 | } 50 | 51 | void color_image_delete(color_image_t *im) { 52 | free(im->c1); 53 | free(im->c2); 54 | free(im->c3); 55 | free(im); 56 | } 57 | 58 | 59 | 60 | image_list_t *image_list_new(void) { 61 | image_list_t *list=NEW(image_list_t); 62 | list->size=list->alloc_size=0; 63 | list->data=NULL; 64 | return list; 65 | } 66 | 67 | void image_list_append(image_list_t *list, image_t *image) { 68 | if(list->size==list->alloc_size) { 69 | list->alloc_size=(list->alloc_size+1)*3/2; 70 | list->data=realloc(list->data,sizeof(*list->data)*list->alloc_size); 71 | } 72 | list->data[list->size++]=image; 73 | } 74 | 75 | void image_list_delete(image_list_t *list) { 76 | int i; 77 | 78 | for(i=0;isize;i++) 79 | image_delete(list->data[i]); 80 | free(list->data); 81 | free(list); 82 | } 83 | 84 | -------------------------------------------------------------------------------- /static/dataset/ferrari/black/3799029235_326325c0d5_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | 9 | <description>F430 Spider in a stunning color combo.</description> 10 | <visibility ispublic="1" isfriend="0" isfamily="0"/> 11 | <dates posted="1249694647" taken="2009-08-01 14:59:33" takengranularity="0" lastupdate="1322272489"/> 12 | <editability cancomment="0" canaddmeta="0"/> 13 | <publiceditability cancomment="1" canaddmeta="0"/> 14 | <usage candownload="1" canblog="0" canprint="0" canshare="1"/> 15 | <comments>4</comments> 16 | <notes/> 17 | <people haspeople="0"/> 18 | <tags> 19 | <tag id="26957369-3799029235-9505" author="26977717@N02" raw="Ferrari" machine_tag="0">ferrari</tag> 20 | <tag id="26957369-3799029235-116028" author="26977717@N02" raw="F430" machine_tag="0">f430</tag> 21 | <tag id="26957369-3799029235-2249" author="26977717@N02" raw="Spider" machine_tag="0">spider</tag> 22 | <tag id="26957369-3799029235-49213" author="26977717@N02" raw="Nero" machine_tag="0">nero</tag> 23 | <tag id="26957369-3799029235-42383" author="26977717@N02" raw="Rosso" machine_tag="0">rosso</tag> 24 | <tag id="26957369-3799029235-472" author="26977717@N02" raw="Black" machine_tag="0">black</tag> 25 | <tag id="26957369-3799029235-227" author="26977717@N02" raw="Red" machine_tag="0">red</tag> 26 | <tag id="26957369-3799029235-6490" author="26977717@N02" raw="Greenwich" machine_tag="0">greenwich</tag> 27 | <tag id="26957369-3799029235-8185" author="26977717@N02" raw="CT" machine_tag="0">ct</tag> 28 | </tags> 29 | <urls> 30 | <url type="photopage">http://www.flickr.com/photos/damianmorysfotos/3799029235/</url> 31 | </urls> 32 | </photo> 33 | </rsp> 34 | 35 | -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/2991213583_a1a410b149_b.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <rsp stat="ok"> 3 | <photo id="2991213583" secret="a1a410b149" server="3037" farm="4" dateuploaded="1225549791" isfavorite="0" 4 | license="5" safety_level="0" rotation="0" originalsecret="5c4f37f132" originalformat="jpg" views="566" 5 | media="photo"> 6 | <owner nsid="29231008@N05" username="CarSpotter" realname="" location="New York" iconserver="3118" 7 | iconfarm="4"/> 8 | <title>Place Vendome 9 | Aargh! Hate those stupid poles. 10 | 11 | 12 | 13 | 14 | 15 | 2 16 | 17 | 18 | 19 | ferrari 20 | 599 21 | 599gtb 22 | fiorano 23 | yellow 24 | ritz 25 | place 26 | vendome 27 | carspotter 28 | 29 | 30 | 31 | http://www.flickr.com/photos/carspotter/2991213583/ 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /util/pyleargist-2.0.5/README.txt: -------------------------------------------------------------------------------- 1 | Python Wrapper for the LEAR image descriptor implementation 2 | =========================================================== 3 | 4 | :author: 5 | 6 | Library to compute GIST global image descriptors to be used to compare pictures 7 | based on their content (to be used global scene recognition and categorization). 8 | 9 | The GIST image descriptor theoritical definition can be found on A. Torralba's 10 | page: http://people.csail.mit.edu/torralba/code/spatialenvelope/ 11 | 12 | The source code of the C implementation is included in the ``lear_gist`` 13 | subfolder. See http://lear.inrialpes.fr/software for the original project 14 | information. 15 | 16 | pyleargist is licensed under the GPL, the same license as the original C 17 | project. 18 | 19 | 20 | Install 21 | ------- 22 | 23 | Install libfftw3 with development headers (http://www.fftw.org), python dev 24 | headers, gcc, the Python Imaging Library (PIL) and numpy. 25 | 26 | Build locally for testing:: 27 | 28 | % python setup.py buid_ext -i 29 | % export PYTHONPATH=`pwd`/src 30 | 31 | Build and install system wide:: 32 | 33 | % python setup.py build 34 | % sudo python setup.py install 35 | 36 | 37 | Usage 38 | ----- 39 | 40 | Here is a sample session in a python shell once the library is installed:: 41 | 42 | >>> from PIL import Image 43 | >>> import leargist 44 | 45 | >>> im = Image.open('lear_gist/ar.ppm') 46 | >>> descriptors = leargist.color_gist(im) 47 | 48 | >>> descriptors.shape 49 | (960,) 50 | 51 | >>> descriptors.dtype 52 | dtype('float32') 53 | 54 | >>> descriptors[:4] 55 | array([ 0.05786307, 0.19255637, 0.09331483, 0.06622448], dtype=float32) 56 | 57 | 58 | The GIST descriptors (fixed size, 960 by default) can then be used as an 59 | euclidian space to cluster images based on their content. 60 | 61 | This dimension can then be reduced to a 32 or 64 bits semantic hash by using 62 | Locality Sensitive Hashing, Spectral Hashing or Stacked Denoising Autoencoders. 63 | 64 | A sample implementation of picture semantic hashing with SDAs is showcased in 65 | the libsgd library: http://code.oliviergrisel.name/libsgd 66 | 67 | Changes 68 | ------- 69 | 70 | - 1.1.0: 2010/03/25 - fix segmentation fault bug, thx to S. Campion 71 | 72 | - 1.0.1: 2009/10/10 - added missing missing MANIFEST 73 | 74 | - 1.0.0: 2009/10/10 - initial release 75 | 76 | -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/2826761418_04874d7f57_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | Very Yellow 9 | Am I the only one who thinks this looks like some crazed monster with eyes wide open and a big 10 | gaping mouth? Maybe it's time to lay off the horror movies lol. Quite a car anyway. 11 | 12 | 13 | 14 | 15 | 16 | 17 | 5 18 | 19 | 20 | 21 | cars 22 | ferrari 23 | ferari 24 | 599 25 | 599gtb 26 | fiorano 27 | paris 28 | yellow 29 | 30 | 31 | http://www.flickr.com/photos/carspotter/2826761418/ 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /static/dataset/ferrari/black/6011433427_cede676575_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 599 GTO ( EXPLORED) 8 | Thanks for 20,000 views! 9 | 10 | I spotted this on Rodeo Dr, and then i saw this at the show the next day! 11 | 12 | 13 | 14 | 15 | 16 | 17 | 15 18 | 19 | 20 | 21 | gto 22 | 599 23 | ferrari 24 | flickr 25 | amazing 26 | black 27 | new 28 | cool 29 | awesome 30 | 31 | 32 | http://www.flickr.com/photos/59051853@N08/6011433427/ 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/2934717590_490a5aeac9_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | Yellow Fezza 9 | Too beautiful. 10 | 11 | 12 | 13 | 14 | 15 | 2 16 | 17 | 18 | 19 | ferrari 20 | f430 21 | 430 22 | spider 23 | yellow 24 | beaulieu 25 | st 26 | jean 27 | cap 28 | ferrat 29 | 30 | 31 | http://www.flickr.com/photos/carspotter/2934717590/ 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /static/dataset/ferrari/red/2902679383_a00f4c9d27_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | Very Red 9 | It's not that I edited this pic a lot, this was just a really bright red F430. Not sure about those 10 | rims though. 11 | 12 | 13 | 14 | 15 | 16 | 17 | 5 18 | 19 | 20 | 21 | red 22 | monaco 23 | beach 24 | club 25 | ferrari 26 | fezza 27 | f430 28 | 430 29 | cool 30 | 31 | 32 | http://www.flickr.com/photos/carspotter/2902679383/ 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /static/dataset/ferrari/black/2828686873_2fa36f83d7_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | Paint it Black 9 | Black Hamann with black rims. Outside the Ritz. In Paris. I. Am. Still. Shocked. 10 | 11 | -- 12 | 13 | <a href="http://www.carspotterphotography.com" 14 | rel="nofollow">www.carspotterphotography.com</a> 15 | 16 | 17 | 18 | 19 | 20 | 12 21 | 22 | 23 | 24 | ferrari 25 | 599 26 | 599gtb 27 | hamann 28 | tuned 29 | fiorano 30 | fast 31 | black 32 | 33 | 34 | http://www.flickr.com/photos/carspotter/2828686873/ 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /static/dataset/ferrari/white/6408311433_38e75ff3b8_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | Ferrari 599 GT0 9 | 10 | 11 | 12 | 13 | 14 | 15 | 2 16 | 17 | 18 | 19 | 599 20 | black 21 | ferrari 22 | gto 23 | sportscars 24 | streetcars 25 | supercar 26 | supercars 27 | white 28 | worldcars 29 | 30 | 31 | http://www.flickr.com/photos/streetcarl/6408311433/ 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /static/dataset/ferrari/black/2888849442_c672a6ba10_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | 599 9 | In the same spot as the Nera, a day later at the same time. This guy also was happy to make some 10 | noise with his car, he gave it this enormous rev and then drove off. 11 | 12 | 13 | 14 | 15 | 16 | 17 | 4 18 | 19 | 20 | 21 | black 22 | nera 23 | ferrari 24 | 599 25 | gtb 26 | 599gtb 27 | fiorano 28 | new 29 | york 30 | 31 | 32 | http://www.flickr.com/photos/carspotter/2888849442/ 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /static/dataset/ferrari/white/6545255463_a83b9f7c40_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | Ferrari California 9 | 10 | 11 | 12 | 13 | 14 | 15 | 3 16 | 17 | 18 | 19 | california 20 | cars 21 | ferrari 22 | london 23 | sportscars 24 | streetcars 25 | supercar 26 | supercars 27 | white 28 | worldcars 29 | 30 | 31 | http://www.flickr.com/photos/streetcarl/6545255463/ 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /static/dataset/ferrari/red/6737987079_b515451dce_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | Ferrari FF red 9 | First test with my tripod 10 | 11 | 12 | 13 | 14 | 15 | 8 16 | 17 | 18 | 19 | cars 20 | london 21 | supercars 22 | supercar 23 | streetcars 24 | sportscars 25 | worldcars 26 | ferrari 27 | ff 28 | red 29 | 30 | 31 | http://www.flickr.com/photos/streetcarl/6737987079/ 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /static/dataset/ferrari/red/4261480774_5e82ea5aab_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | F50. 9 | At the detailing area of Ferrari of Greenwich, only 400 miles on this beast. 10 | 11 | 12 | 13 | 14 | 15 | 11 16 | 17 | 18 | 19 | ferrari 20 | f50 21 | italian 22 | supercar 23 | rare 24 | red 25 | greenwich 26 | canon 27 | 1740mm 28 | l 29 | 30 | 31 | http://www.flickr.com/photos/damianmorysfotos/4261480774/ 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /static/dataset/ferrari/red/5751134603_33282e19e2_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | .599 "gto" 9 | <i> Paris, 2011 </i> 10 | 11 | In the first moments i didn`t realised that this car is just a <b>599 GTB</b>, seems like the 12 | owner made a good job! How do you like the car? In my opinion it looks just amazing, especially with this 13 | red Ferrari-emblem on the rims! 14 | 15 | <b> Feel free to comment and vote ;-) </b> 16 | 17 | 18 | 19 | 20 | 21 | 19 22 | 23 | Insane! 25 | 26 | 27 | 28 | 29 | 31 | Villerville 32 | Calvados 33 | Basse-Normandie 34 | France 35 | 36 | 37 | 38 | http://www.flickr.com/photos/bongosphotographie/5751134603/ 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /static/dataset/ferrari/black/3053451700_0c24eae7ed_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | Plaza Athenee 9 | Speaks for itself. 10 | 11 | 12 | 13 | 14 | 15 | 4 16 | 17 | 18 | 19 | ferrari 20 | 599 21 | gtb 22 | 599gtb 23 | f599 24 | hamann 25 | tuned 26 | black 27 | plaza 28 | athenee 29 | pari 30 | 31 | 32 | http://www.flickr.com/photos/carspotter/3053451700/ 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /static/dataset/ferrari/white/3863563450_db8cb5f947_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | 9 | <description>Such a sick car.</description> 10 | <visibility ispublic="1" isfriend="0" isfamily="0"/> 11 | <dates posted="1251415255" taken="2009-08-16 06:39:36" takengranularity="0" lastupdate="1326937320"/> 12 | <editability cancomment="0" canaddmeta="0"/> 13 | <publiceditability cancomment="1" canaddmeta="0"/> 14 | <usage candownload="1" canblog="0" canprint="0" canshare="1"/> 15 | <comments>6</comments> 16 | <notes/> 17 | <people haspeople="0"/> 18 | <tags> 19 | <tag id="26957369-3863563450-9505" author="26977717@N02" raw="Ferrari" machine_tag="0">ferrari</tag> 20 | <tag id="26957369-3863563450-49217" author="26977717@N02" raw="Scuderia" machine_tag="0">scuderia</tag> 21 | <tag id="26957369-3863563450-294159" author="26977717@N02" raw="Scud" machine_tag="0">scud</tag> 22 | <tag id="26957369-3863563450-118184" author="26977717@N02" raw="Spud" machine_tag="0">spud</tag> 23 | <tag id="26957369-3863563450-766103" author="26977717@N02" raw="16M" machine_tag="0">16m</tag> 24 | <tag id="26957369-3863563450-37725" author="26977717@N02" raw="limited" machine_tag="0">limited</tag> 25 | <tag id="26957369-3863563450-37726" author="26977717@N02" raw="edition" machine_tag="0">edition</tag> 26 | <tag id="26957369-3863563450-47566" author="26977717@N02" raw="rare" machine_tag="0">rare</tag> 27 | <tag id="26957369-3863563450-395" author="26977717@N02" raw="white" machine_tag="0">white</tag> 28 | <tag id="26957369-3863563450-48298" author="26977717@N02" raw="Lugano" machine_tag="0">lugano</tag> 29 | <tag id="26957369-3863563450-2110" author="26977717@N02" raw="Switzerland" machine_tag="0">switzerland</tag> 30 | </tags> 31 | <urls> 32 | <url type="photopage">http://www.flickr.com/photos/damianmorysfotos/3863563450/</url> 33 | </urls> 34 | </photo> 35 | </rsp> 36 | 37 | -------------------------------------------------------------------------------- /static/dataset/ferrari/white/6538116347_ed6bff7cff_b.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <rsp stat="ok"> 3 | <photo id="6538116347" secret="ed6bff7cff" server="7024" farm="8" dateuploaded="1324308912" isfavorite="0" 4 | license="5" safety_level="0" rotation="0" originalsecret="135bb12c0f" originalformat="jpg" views="47" 5 | media="photo"> 6 | <owner nsid="67847534@N03" username="Ben_in_london" realname="Ben" location="LONDON, United Kingdom" 7 | iconserver="6173" iconfarm="7"/> 8 | <title>Ferrari California Matte white 9 | 10 | 11 | 12 | 13 | 14 | 15 | 1 16 | 17 | 18 | 19 | ferrari 20 | california 21 | matte 22 | white 23 | cars 24 | london 25 | supercars 26 | supercar 27 | streetcars 28 | sportscars 29 | worldcars 30 | 31 | 32 | http://www.flickr.com/photos/streetcarl/6538116347/ 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /util/prepare.py: -------------------------------------------------------------------------------- 1 | import os 2 | from img_hash import EXTS, phash, otsu_hash, otsu_hash2 3 | from img_histo import gray_histo, rgb_histo, yuv_histo, hsv_histo 4 | from img_gist import gist 5 | from img_hog import hog3, hog_histo, hog_lsh_list 6 | from lsh import LSH_hog, LSH_sift 7 | from img_sift import sift2, sift_lsh_list, sift_histo 8 | 9 | def prepare(setname, func, p_out): 10 | p_out = '../conf/%s_%s.txt' % (setname, p_out) 11 | with open(p_out, 'w') as f_out: 12 | relative_path = '../static/dataset/%s' % setname 13 | for root, dirs, files in os.walk(relative_path): 14 | for f in files: 15 | postfix = f.split('.')[-1] 16 | if postfix not in EXTS: continue 17 | full_path = os.path.join(root, f) 18 | try: 19 | F = func(full_path) 20 | f_out.write('%s\t%s\n' % (full_path[2:], repr(F))) 21 | except Exception, e: 22 | print repr(e) 23 | print full_path 24 | 25 | def prepare_local(setname, f_func, h_func, p_out): 26 | p_out = '../conf/%s_%s.txt' % (setname, p_out) 27 | with open(p_out, 'w') as f_out: 28 | relative_path = '../static/dataset/%s' % setname 29 | for root, dirs, files in os.walk(relative_path): 30 | for f in files: 31 | postfix = f.split('.')[-1] 32 | if postfix not in EXTS: continue 33 | full_path = os.path.join(root, f) 34 | try: 35 | F = f_func(full_path) 36 | for f in F: 37 | f = list(f) 38 | h = h_func(f) 39 | f_out.write('%s\t%s\t%s\n' % (full_path[2:], repr(f), repr(h))) 40 | except Exception, e: 41 | print repr(e) 42 | print full_path 43 | 44 | def prepare_all(setname): 45 | prepare(dataset, phash, 'phash') 46 | prepare(dataset, otsu_hash, 'otsu_hash') 47 | prepare(dataset, otsu_hash2, 'otsu_hash2') 48 | 49 | prepare(dataset, gray_histo, 'grayhisto') 50 | prepare(dataset, rgb_histo, 'rgbhisto') 51 | prepare(dataset, yuv_histo, 'yuvhisto') 52 | prepare(dataset, hsv_histo, 'hsvhisto') 53 | 54 | prepare(dataset, gist, 'gist') 55 | 56 | prepare_local(dataset, hog3, LSH_hog, 'hog_lsh') 57 | prepare_local(dataset, sift2, LSH_sift, 'sift_lsh') 58 | 59 | if __name__ == '__main__': 60 | #dataset = 'simpcity' 61 | #dataset = 'infochimps' 62 | dataset = 'ferrari' 63 | #dataset = 'mixed' 64 | prepare_all(dataset) 65 | 66 | -------------------------------------------------------------------------------- /util/pyleargist-2.0.5/src/leargist.pyx: -------------------------------------------------------------------------------- 1 | from libc.stdlib cimport free 2 | 3 | from cpython cimport PyObject, Py_INCREF 4 | import cython 5 | 6 | cimport leargist 7 | import numpy as np 8 | cimport numpy as np 9 | np.import_array() 10 | 11 | cdef extern from "stdlib.h" nogil: 12 | void *memmove(void *str1, void *str2, size_t n) 13 | 14 | cdef extern from "standalone_image.h": 15 | ctypedef struct color_image_t: 16 | int width 17 | int height 18 | float *c1 # R 19 | float *c2 # G 20 | float *c3 # B 21 | cdef color_image_t* color_image_new(int width, int height) 22 | cdef void color_image_delete(color_image_t *image) 23 | 24 | cdef extern from "gist.h": 25 | cdef float* color_gist_scaletab(color_image_t* src, int nblocks, int n_scale, int* n_orientations) 26 | cdef void free_desc(float *d) 27 | 28 | def color_gist(im, nblocks=4, orientations=(8, 8, 4)): 29 | """Compute the GIST descriptor of an RGB image""" 30 | scales = len(orientations) 31 | orientations = np.array(orientations, dtype=np.int32) 32 | 33 | # check minimum image size 34 | if im.size[0] < 8 or im.size[1] < 8: 35 | raise ValueError( 36 | "image size should at least be (8, 8), got %r" % (im.size,)) 37 | 38 | # ensure the image is encoded in RGB 39 | im = im.convert(mode='RGB') 40 | 41 | # build the lear_gist color image C datastructure 42 | arr = np.fromstring(im.tostring(), np.uint8) 43 | arr.shape = list(im.size) + [3] 44 | arr = arr.transpose(2, 0, 1) 45 | arr = np.ascontiguousarray(arr, dtype=np.float32) 46 | 47 | width, height = im.size 48 | cdef leargist.color_image_t* _c_color_image_t = leargist.color_image_new(width, height) 49 | 50 | 51 | size = width * height * cython.sizeof(cython.float) 52 | memmove(_c_color_image_t.c1, np.PyArray_DATA(arr[0]), size ) 53 | memmove(_c_color_image_t.c2, np.PyArray_DATA(arr[1]), size ) 54 | memmove(_c_color_image_t.c3, np.PyArray_DATA(arr[2]), size ) 55 | 56 | cdef int nb = nblocks 57 | cdef int s = scales 58 | cdef int* no = np.PyArray_DATA(orientations) 59 | array = leargist.color_gist_scaletab(_c_color_image_t, nb, s, no) 60 | leargist.color_image_delete(_c_color_image_t) 61 | 62 | cdef np.npy_intp dim = nblocks * nblocks * orientations.sum() * 3 63 | cdef np.ndarray g = np.PyArray_SimpleNewFromData(1, &dim, np.NPY_FLOAT, 64 | array) 65 | r = g.copy() 66 | free(array) 67 | return r 68 | -------------------------------------------------------------------------------- /static/dataset/ferrari/black/6864401265_b7b37ac522_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | 458 Italia. 9 | 10 | 11 | 12 | 13 | 14 | 15 | 6 16 | 17 | 18 | 19 | ferrari 20 | 458 21 | italia 22 | black 23 | nero 24 | supercar 25 | fast 26 | rare 27 | exotic 28 | long 29 | island 30 | ny 31 | 32 | 33 | http://www.flickr.com/photos/damianmorysfotos/6864401265/ 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/4175517996_6245a0907c_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | Ferrari F430 Scuderia 9 | <a href="http://www.twitter.com/torquespeak" rel="nofollow">www.twitter.com/torquespeak</a> 10 | 11 | 12 | 13 | 14 | 15 | 3 16 | 17 | 18 | 19 | london 20 | ferrari 21 | 430 22 | f430 23 | scud 24 | scuderia 25 | stripes 26 | yellow 27 | giallo 28 | lights 29 | parked 30 | 31 | 32 | http://www.flickr.com/photos/ejcallow/4175517996/ 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /static/dataset/ferrari/black/3714394095_a28ee188cb_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | 9 | <description>Two murdered out beasts.</description> 10 | <visibility ispublic="1" isfriend="0" isfamily="0"/> 11 | <dates posted="1247447334" taken="2009-07-10 10:20:47" takengranularity="0" lastupdate="1321933661"/> 12 | <editability cancomment="0" canaddmeta="0"/> 13 | <publiceditability cancomment="1" canaddmeta="1"/> 14 | <usage candownload="1" canblog="0" canprint="0" canshare="1"/> 15 | <comments>2</comments> 16 | <notes/> 17 | <people haspeople="0"/> 18 | <tags> 19 | <tag id="26957369-3714394095-73633" author="26977717@N02" raw="Matte" machine_tag="0">matte</tag> 20 | <tag id="26957369-3714394095-472" author="26977717@N02" raw="Black" machine_tag="0">black</tag> 21 | <tag id="26957369-3714394095-9505" author="26977717@N02" raw="Ferrari" machine_tag="0">ferrari</tag> 22 | <tag id="26957369-3714394095-116028" author="26977717@N02" raw="F430" machine_tag="0">f430</tag> 23 | <tag id="26957369-3714394095-49172" author="26977717@N02" raw="Coupe" machine_tag="0">coupe</tag> 24 | <tag id="26957369-3714394095-17477" author="26977717@N02" raw="Shelby" machine_tag="0">shelby</tag> 25 | <tag id="26957369-3714394095-58001" author="26977717@N02" raw="Bullrun" machine_tag="0">bullrun</tag> 26 | <tag id="26957369-3714394095-48795" author="26977717@N02" raw="2009" machine_tag="0">2009</tag> 27 | <tag id="26957369-3714394095-278285" author="26977717@N02" raw="CEC" machine_tag="0">cec</tag> 28 | <tag id="26957369-3714394095-6727" author="26977717@N02" raw="wheels" machine_tag="0">wheels</tag> 29 | <tag id="26957369-3714394095-22801" author="26977717@N02" raw="Pepsi" machine_tag="0">pepsi</tag> 30 | <tag id="26957369-3714394095-490" author="26977717@N02" raw="Max" machine_tag="0">max</tag> 31 | </tags> 32 | <urls> 33 | <url type="photopage">http://www.flickr.com/photos/damianmorysfotos/3714394095/</url> 34 | </urls> 35 | </photo> 36 | </rsp> 37 | 38 | -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/3744005153_78bb835f3f_b.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <rsp stat="ok"> 3 | <photo id="3744005153" secret="78bb835f3f" server="2614" farm="3" dateuploaded="1248225195" isfavorite="0" 4 | license="4" safety_level="0" rotation="0" originalsecret="49bbb8f8b0" originalformat="jpg" views="269" 5 | media="photo"> 6 | <owner nsid="26977717@N02" username="Damian Morys Foto" realname="Damian Morys" 7 | location="New York City, United States" iconserver="3129" iconfarm="4"/> 8 | <title/> 9 | <description>Happynus.</description> 10 | <visibility ispublic="1" isfriend="0" isfamily="0"/> 11 | <dates posted="1248225195" taken="2009-07-11 17:52:18" takengranularity="0" lastupdate="1322272471"/> 12 | <editability cancomment="0" canaddmeta="0"/> 13 | <publiceditability cancomment="1" canaddmeta="1"/> 14 | <usage candownload="1" canblog="0" canprint="0" canshare="1"/> 15 | <comments>3</comments> 16 | <notes/> 17 | <people haspeople="0"/> 18 | <tags> 19 | <tag id="26957369-3744005153-9505" author="26977717@N02" raw="Ferrari" machine_tag="0">ferrari</tag> 20 | <tag id="26957369-3744005153-116028" author="26977717@N02" raw="F430" machine_tag="0">f430</tag> 21 | <tag id="26957369-3744005153-9983" author="26977717@N02" raw="Spyder" machine_tag="0">spyder</tag> 22 | <tag id="26957369-3744005153-987" author="26977717@N02" raw="yellow" machine_tag="0">yellow</tag> 23 | <tag id="26957369-3744005153-13029" author="26977717@N02" raw="Giallo" machine_tag="0">giallo</tag> 24 | <tag id="26957369-3744005153-29865" author="26977717@N02" raw="Modena" machine_tag="0">modena</tag> 25 | <tag id="26957369-3744005153-1398" author="26977717@N02" raw="ball" machine_tag="0">ball</tag> 26 | <tag id="26957369-3744005153-73281" author="26977717@N02" raw="polished" machine_tag="0">polished</tag> 27 | <tag id="26957369-3744005153-6727" author="26977717@N02" raw="wheels" machine_tag="0">wheels</tag> 28 | <tag id="26957369-3744005153-6490" author="26977717@N02" raw="Greenwich" machine_tag="0">greenwich</tag> 29 | <tag id="26957369-3744005153-8185" author="26977717@N02" raw="CT" machine_tag="0">ct</tag> 30 | <tag id="26957369-3744005153-2249" author="26977717@N02" raw="Spider" machine_tag="0">spider</tag> 31 | </tags> 32 | <urls> 33 | <url type="photopage">http://www.flickr.com/photos/damianmorysfotos/3744005153/</url> 34 | </urls> 35 | </photo> 36 | </rsp> 37 | 38 | -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/3937826223_3d6769fe74_b.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <rsp stat="ok"> 3 | <photo id="3937826223" secret="3d6769fe74" server="2487" farm="3" dateuploaded="1253476959" isfavorite="0" 4 | license="4" safety_level="0" rotation="0" originalsecret="ffa8097f3f" originalformat="jpg" views="538" 5 | media="photo"> 6 | <owner nsid="31797562@N04" username="Ed Callow [ torquespeak ]" realname="Ed Callow" location="" 7 | iconserver="3068" iconfarm="4"/> 8 | <title>Ferrari F430 Scuderia 9 | <a href="http://torquespeak.wordpress.com" 10 | rel="nofollow">torquespeak.wordpress.com</a> 11 | 12 | 13 | 14 | 15 | 16 | 1 17 | 18 | 19 | 20 | ferrari 21 | f430 22 | scuderia 23 | yellow 24 | giallo 25 | 26 | 28 | Mayfair 29 | London 30 | Greater London 31 | England 32 | United Kingdom 33 | 34 | 35 | 36 | http://www.flickr.com/photos/ejcallow/3937826223/ 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/4451720072_d402f28616_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | Ferrari California 9 | <a href="http://www.twitter.com/torquespeak" rel="nofollow">www.twitter.com/torquespeak</a> 10 | 11 | 12 | 13 | 14 | 15 | 5 16 | 17 | 18 | 19 | london 20 | ferrari 21 | california 22 | 1fab 23 | 24 | personalisedplate 25 | 26 | bbc 27 | yellow 28 | giallo 29 | chrisevans 30 | 31 | private 32 | plate 33 | 34 | 35 | http://www.flickr.com/photos/ejcallow/4451720072/ 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /static/dataset/ferrari/white/5608028246_19a145c4e3_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | Ferrari F430 Spider 9 | <a href="http://www.twitter.com/torquespeak" rel="nofollow">www.twitter.com/torquespeak</a> 10 | 11 | 12 | 13 | 14 | 15 | 1 16 | 17 | 18 | 19 | london 20 | supercar 21 | fast 22 | speed 23 | sw3 24 | ferrari 25 | f430 26 | spider 27 | polar 28 | white 29 | panning 30 | pan 31 | 32 | 33 | http://www.flickr.com/photos/ejcallow/5608028246/ 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/4608953535_59ec97f93a_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | 1962 Ferrari 250 GT Berlinetta - yellow - fvl 9 | Greystone Mansion Inaugural Concours d'Elegance, April 11, 2010 10 | 11 | 12 | 13 | 14 | 15 | 2 16 | 17 | 18 | 19 | 20 | concoursdelegance 21 | 22 | 23 | greystonemansion 24 | 25 | ferrari 26 | italiancars 27 | 28 | yellowferrari 29 | 30 | 31 | 33 | Beverly Hills 34 | Los Angeles 35 | California 36 | United States 37 | 38 | 39 | 40 | http://www.flickr.com/photos/rexgray/4608953535/ 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/4608953767_0f2f054c87_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | 1962 Ferrari 250 GT Berlinetta - yellow - rvr 9 | Greystone Mansion Inaugural Concours d'Elegance, April 11, 2010 10 | 11 | 12 | 13 | 14 | 15 | 0 16 | 17 | 18 | 19 | 20 | concoursdelegance 21 | 22 | 23 | greystonemansion 24 | 25 | ferrari 26 | italiancars 27 | 28 | yellowferrari 29 | 30 | 31 | 33 | Beverly Hills 34 | Los Angeles 35 | California 36 | United States 37 | 38 | 39 | 40 | http://www.flickr.com/photos/rexgray/4608953767/ 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /static/dataset/ferrari/black/2911718073_9257a35692_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | Hamann and Drop 9 | Nice combo at the Ritz. 10 | 11 | 12 | 13 | 14 | 15 | 8 16 | 17 | 18 | 19 | ferrari 20 | black 21 | 599 22 | 599gtb 23 | hamann 24 | fiorano 25 | rare 26 | paris 27 | rolls 28 | royce 29 | phantom 30 | drophead 31 | coupe 32 | 33 | 34 | http://www.flickr.com/photos/carspotter/2911718073/ 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /static/dataset/ferrari/white/6572006743_6e42346e51_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | Ferrari 599 gto 9 | 10 | 11 | 12 | 13 | 14 | 15 | 5 16 | 17 | 18 | 19 | 599 20 | ferrari 21 | sportscars 22 | streetcars 23 | stripes 24 | supercar 25 | supercars 26 | cars 27 | london 28 | worldcars 29 | white 30 | black 31 | f599 32 | 33 | 34 | http://www.flickr.com/photos/streetcarl/6572006743/ 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/4356830323_85e00e03f3_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | Ferrari California 9 | <a href="http://www.twitter.com/torquespeak" rel="nofollow">www.twitter.com/torquespeak</a> 10 | 11 | 12 | 13 | 14 | 15 | 5 16 | 17 | 18 | 19 | london 20 | ferrari 21 | california 22 | yellow 23 | chrisevans 24 | 25 | spy500 26 | 27 | personalisedplate 28 | 29 | bbc 30 | 31 | westernhouse 32 | 33 | postbox 34 | giallo 35 | 36 | 37 | http://www.flickr.com/photos/ejcallow/4356830323/ 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /static/dataset/ferrari/black/3853685157_cd2dd3ab80_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | 9 | <description>Beauty.</description> 10 | <visibility ispublic="1" isfriend="0" isfamily="0"/> 11 | <dates posted="1251160835" taken="2009-08-13 11:21:07" takengranularity="0" lastupdate="1317327812"/> 12 | <editability cancomment="0" canaddmeta="0"/> 13 | <publiceditability cancomment="1" canaddmeta="0"/> 14 | <usage candownload="1" canblog="0" canprint="0" canshare="1"/> 15 | <comments>4</comments> 16 | <notes/> 17 | <people haspeople="0"/> 18 | <tags> 19 | <tag id="26957369-3853685157-9505" author="26977717@N02" raw="Ferrari" machine_tag="0">ferrari</tag> 20 | <tag id="26957369-3853685157-515196" author="26977717@N02" raw="599" machine_tag="0">599</tag> 21 | <tag id="26957369-3853685157-119234" author="26977717@N02" raw="GTB" machine_tag="0">gtb</tag> 22 | <tag id="26957369-3853685157-663459" author="26977717@N02" raw="Fiorano" machine_tag="0">fiorano</tag> 23 | <tag id="26957369-3853685157-472" author="26977717@N02" raw="Black" machine_tag="0">black</tag> 24 | <tag id="26957369-3853685157-7104" author="26977717@N02" raw="over" machine_tag="0">over</tag> 25 | <tag id="26957369-3853685157-227" author="26977717@N02" raw="Red" machine_tag="0">red</tag> 26 | <tag id="26957369-3853685157-13796" author="26977717@N02" raw="German" machine_tag="0">german</tag> 27 | <tag id="26957369-3853685157-22007" author="26977717@N02" raw="plates" machine_tag="0">plates</tag> 28 | <tag id="26957369-3853685157-6446" author="26977717@N02" raw="Zurich" machine_tag="0">zurich</tag> 29 | <tag id="26957369-3853685157-2110" author="26977717@N02" raw="Switzerland" machine_tag="0">switzerland</tag> 30 | <tag id="26957369-3853685157-5111" author="26977717@N02" raw="Euro" machine_tag="0">euro</tag> 31 | <tag id="26957369-3853685157-116" author="26977717@N02" raw="Trip" machine_tag="0">trip</tag> 32 | <tag id="26957369-3853685157-14077" author="26977717@N02" raw="09" machine_tag="0">09</tag> 33 | </tags> 34 | <urls> 35 | <url type="photopage">http://www.flickr.com/photos/damianmorysfotos/3853685157/</url> 36 | </urls> 37 | </photo> 38 | </rsp> 39 | 40 | -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/5434338226_eb0755f9d8_b.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <rsp stat="ok"> 3 | <photo id="5434338226" secret="eb0755f9d8" server="5255" farm="6" dateuploaded="1297364397" isfavorite="0" 4 | license="4" safety_level="0" rotation="0" originalsecret="723fa8f5a0" originalformat="jpg" views="553" 5 | media="photo"> 6 | <owner nsid="31797562@N04" username="Ed Callow [ torquespeak ]" realname="Ed Callow" location="" 7 | iconserver="3068" iconfarm="4"/> 8 | <title>Ferrari 458 Italia 9 | <a href="http://twitter.com/torquespeak" 10 | rel="nofollow">twitter.com/torquespeak</a> 11 | 12 | 13 | 14 | 15 | 16 | 0 17 | 18 | 19 | 20 | ferrari 21 | 458 22 | italia 23 | front 24 | quarter 25 | giallo 26 | yellow 27 | sloane 28 | street 29 | supercar 30 | driving 31 | angle 32 | v8 33 | 34 | 35 | http://www.flickr.com/photos/ejcallow/5434338226/ 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /util/kmeans.py: -------------------------------------------------------------------------------- 1 | import os 2 | import math 3 | import random 4 | import copy 5 | import numpy as np 6 | from numpy import array 7 | from img_hash import EXTS 8 | 9 | def norm0_dist(h1, h2): 10 | return len(h1) - sum(array(h1)==array(h2)) 11 | 12 | def eculidean_dist(h1, h2): 13 | return math.sqrt(square_eculidean_dist(h1, h2)) 14 | 15 | def square_eculidean_dist(h1, h2): 16 | return sum((array(h1)-array(h2))**2) 17 | 18 | def kmeans_classify(centers, h): 19 | min_c, min_d = -1, -1 20 | for c, center in enumerate(centers): 21 | d = square_eculidean_dist(h, center) 22 | if min_c == -1 or d < min_d: 23 | min_c, min_d = c, d 24 | return min_c 25 | 26 | def save_centers(p_out, centers): 27 | with open(p_out, 'w') as fout: 28 | for center in centers: 29 | fout.write('%s\n' % (repr(center))) 30 | 31 | def load_centers(p_center): 32 | centers = [] 33 | for line in open(p_center): 34 | centers.append(eval(line.strip())) 35 | return centers 36 | 37 | def kmeans(p_feat, p_out, nclass=100, max_iter=100, percent=0.02, theta=0.01): 38 | feat_list = [] 39 | for line in open(p_feat): 40 | if random.random() <= percent: 41 | arr = line.strip().split('\t') 42 | path, feat = arr[0], eval(arr[1]) 43 | feat_list.append(feat) 44 | print 'feat_list len', len(feat_list) 45 | print 'feat len', len(feat_list[0]) 46 | 47 | theta2 = nclass * 100. / len(feat_list) 48 | print 'theta2', theta2 49 | 50 | centers = random.sample(feat_list, nclass) 51 | for niter in range(max_iter): 52 | print 'iter %d...' % niter 53 | old_centers = copy.deepcopy(centers) 54 | print 'old_centers finished' 55 | class_feats = [[] for i in range(len(centers))] 56 | print 'class_feats initialized' 57 | for feat in feat_list: 58 | if random.random() < theta2: 59 | min_c = kmeans_classify(centers, feat) 60 | class_feats[min_c].append(feat) 61 | print 'class_feats finished' 62 | 63 | centers = [] 64 | for i, feats in enumerate(class_feats): 65 | if feats: 66 | centers.append(list(np.mean(feats, 0))) 67 | else: 68 | centers.append([0]*len(feat_list[0])) 69 | print 'centers finished, len:', len(centers) 70 | 71 | save_centers(p_out, centers) 72 | print 'saved centers...' 73 | 74 | diff = 0 75 | for c, center in enumerate(centers): 76 | diff += eculidean_dist(center, old_centers[c]) 77 | print 'diff %s', diff 78 | if diff < theta: 79 | break 80 | 81 | def test(): 82 | a = [[1, 2], [5,6]] 83 | b = [1.3, 3] 84 | c = kmeans_classify(a, b) 85 | print a, b, c 86 | 87 | 88 | if __name__ == '__main__': 89 | test() 90 | 91 | -------------------------------------------------------------------------------- /util/pyleargist-2.0.5/lear_gist/compute_gist.c: -------------------------------------------------------------------------------- 1 | /* Lear's GIST implementation, version 1.0, (c) INRIA 2009, Licence: GPL */ 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | #include "gist.h" 9 | 10 | 11 | 12 | static color_image_t *load_ppm(const char *fname) { 13 | FILE *f=fopen(fname,"r"); 14 | if(!f) { 15 | perror("could not open infile"); 16 | exit(1); 17 | } 18 | int width,height,maxval; 19 | if(fscanf(f,"P6 %d %d %d",&width,&height,&maxval)!=3 || 20 | maxval!=255) { 21 | fprintf(stderr,"Error: input not a raw PPM with maxval 255\n"); 22 | exit(1); 23 | } 24 | fgetc(f); /* eat the newline */ 25 | color_image_t *im=color_image_new(width,height); 26 | 27 | int i; 28 | for(i=0;ic1[i]=fgetc(f); 30 | im->c2[i]=fgetc(f); 31 | im->c3[i]=fgetc(f); 32 | } 33 | 34 | fclose(f); 35 | return im; 36 | } 37 | 38 | 39 | static void usage(void) { 40 | fprintf(stderr,"compute_gist options... [infilename]\n" 41 | "infile is a PPM raw file\n" 42 | "options:\n" 43 | "[-nblocks nb] use a grid of nb*nb cells (default 4)\n" 44 | "[-orientationsPerScale o_1,..,o_n] use n scales and compute o_i orientations for scale i\n" 45 | ); 46 | 47 | exit(1); 48 | } 49 | 50 | 51 | 52 | int main(int argc,char **args) { 53 | 54 | const char *infilename="/dev/stdin"; 55 | int nblocks=4; 56 | int n_scale=3; 57 | int orientations_per_scale[50]={8,8,4}; 58 | 59 | 60 | while(*++args) { 61 | const char *a=*args; 62 | 63 | if(!strcmp(a,"-h")) usage(); 64 | else if(!strcmp(a,"-nblocks")) { 65 | if(!sscanf(*++args,"%d",&nblocks)) { 66 | fprintf(stderr,"could not parse %s argument",a); 67 | usage(); 68 | } 69 | } else if(!strcmp(a,"-orientationsPerScale")) { 70 | char *c; 71 | n_scale=0; 72 | for(c=strtok(*++args,",");c;c=strtok(NULL,",")) { 73 | if(!sscanf(c,"%d",&orientations_per_scale[n_scale++])) { 74 | fprintf(stderr,"could not parse %s argument",a); 75 | usage(); 76 | } 77 | } 78 | } else { 79 | infilename=a; 80 | } 81 | } 82 | 83 | color_image_t *im=load_ppm(infilename); 84 | 85 | float *desc=color_gist_scaletab(im,nblocks,n_scale,orientations_per_scale); 86 | 87 | int i; 88 | 89 | int descsize=0; 90 | /* compute descriptor size */ 91 | for(i=0;i 2 | 3 | 6 | 8 | Profile 9 | Happy to see this today. I think this to be one of my better pics. <a 10 | href="http://bighugelabs.com/flickr/onblack.php?id=3144680857&amp;size=large">View On 11 | Black</a> 12 | 13 | 14 | 15 | 16 | 17 | 8 18 | 19 | 20 | 21 | stunning 22 | black 23 | ferrari 24 | fezza 25 | f430 26 | 430 27 | new 28 | york 29 | ny 30 | nyc 31 | rare 32 | exotic 33 | supercar 34 | 35 | 36 | http://www.flickr.com/photos/carspotter/3144680857/ 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /static/dataset/ferrari/red/5608030160_edd9c359c1_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | Ferrari 458 Italia 9 | <a href="http://www.twitter.com/torquespeak" rel="nofollow">www.twitter.com/torquespeak</a> 10 | 11 | 12 | 13 | 14 | 15 | 1 16 | 17 | 18 | 19 | london 20 | supercar 21 | fast 22 | speed 23 | sw3 24 | ferrari 25 | 458 26 | italia 27 | red 28 | rosso 29 | panning 30 | pan 31 | blur 32 | harrods 33 | 34 | 35 | http://www.flickr.com/photos/ejcallow/5608030160/ 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/227416776_2dc8b1ec1e_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 7 | Ferrari 599 GTB Fiorano Rear 8 | A view of the rear of the 2006 Ferrari 599 GTB Fiorano car. Image was taken at the 2006 Goodwood 9 | Festival of Speed, West Sussex, United Kingdom. 10 | 11 | The car's colour/color is Giallo Modena (Ferrari Light Yellow) 12 | 13 | This photo is available on the Wikimedia Commons at <a 14 | href="http://commons.wikimedia.org/wiki/Image:2006FOS_Ferrari599GTB.jpg">commons.wikimedia.org/wiki/Image:2006FOS_Ferrari599GTB.jpg</a> 15 | 16 | 17 | 18 | 19 | 20 | 2 21 | 22 | 23 | 24 | goodwood 25 | festival 26 | speed 27 | ferrari 28 | 599 29 | gtb 30 | 31 | 33 | Goodwood House 34 | West Sussex 35 | England 36 | United Kingdom 37 | 38 | 39 | 40 | http://www.flickr.com/photos/alexcjones/227416776/ 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /static/dataset/ferrari/black/3853040578_7f8a725cff_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | 599 GTB Fiorano. 9 | Stunning 599 parked in Zurich. 10 | 11 | 12 | 13 | 14 | 15 | 9 16 | 17 | 18 | 19 | ferrari 20 | 599 21 | gtb 22 | fiorano 23 | black 24 | over 25 | red 26 | german 27 | plates 28 | zurich 29 | switzerland 30 | europe 31 | euro 32 | trip 33 | 09 34 | 35 | 36 | http://www.flickr.com/photos/damianmorysfotos/3853040578/ 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/3938602096_0e8d1f20b1_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | Ferrari California 9 | <a href="http://torquespeak.wordpress.com" 10 | rel="nofollow">torquespeak.wordpress.com</a> 11 | 12 | 13 | 14 | 15 | 16 | 5 17 | 18 | 19 | 20 | ferrari 21 | california 22 | yellow 23 | giallo 24 | spy500 25 | 26 | personalisedplate 27 | 28 | chrisevans 29 | 30 | 31 | 33 | Fitzrovia 34 | London 35 | Greater London 36 | England 37 | United Kingdom 38 | 39 | 40 | 41 | http://www.flickr.com/photos/ejcallow/3938602096/ 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /static/dataset/ferrari/red/3852233337_7593a392c1_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | 360 Spider. 9 | I'm back from Europe! Loads of shots coming this week of some amazing cars. Figured I'd start with 10 | this since I saw it only 10 minutes after I left the airport. Insane 360 in Zurich. 11 | 12 | 13 | 14 | 15 | 16 | 17 | 3 18 | 19 | 20 | 21 | ferrari 22 | 360 23 | spider 24 | red 25 | black 26 | wheels 27 | coated 28 | painted 29 | zurich 30 | switzerland 31 | europe 32 | euro 33 | trip 34 | 09 35 | 36 | 37 | http://www.flickr.com/photos/damianmorysfotos/3852233337/ 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/4187538919_c1320d4ea7_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | Ferrari and G-Wiz in Berkeley Square 9 | Two G-Wiz electric cars refuelling on electricity in the street, parked next to a huge gas-guzzling 10 | yellow Ferrari... 11 | 12 | 13 | 14 | 15 | 16 | 17 | 1 18 | 19 | 20 | 21 | gwiz 22 | electric 23 | car 24 | cars 25 | electricity 26 | green 27 | environment 28 | yellow 29 | ferrari 30 | berkeley 31 | square 32 | mayfair 33 | london 34 | cop15 35 | copenhagen 36 | 37 | 38 | http://www.flickr.com/photos/markhillary/4187538919/ 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /static/dataset/ferrari/red/3862801353_58634506b4_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | 9 | <description>Perfect location to shoot a 360.</description> 10 | <visibility ispublic="1" isfriend="0" isfamily="0"/> 11 | <dates posted="1251415823" taken="2009-08-16 06:26:13" takengranularity="0" lastupdate="1264353767"/> 12 | <editability cancomment="0" canaddmeta="0"/> 13 | <publiceditability cancomment="1" canaddmeta="0"/> 14 | <usage candownload="1" canblog="0" canprint="0" canshare="1"/> 15 | <comments>5</comments> 16 | <notes/> 17 | <people haspeople="0"/> 18 | <tags> 19 | <tag id="26957369-3862801353-9505" author="26977717@N02" raw="Ferrari" machine_tag="0">ferrari</tag> 20 | <tag id="26957369-3862801353-8686" author="26977717@N02" raw="360" machine_tag="0">360</tag> 21 | <tag id="26957369-3862801353-29865" author="26977717@N02" raw="Modena" machine_tag="0">modena</tag> 22 | <tag id="26957369-3862801353-227" author="26977717@N02" raw="Red" machine_tag="0">red</tag> 23 | <tag id="26957369-3862801353-312929" author="26977717@N02" raw="Rossa" machine_tag="0">rossa</tag> 24 | <tag id="26957369-3862801353-16357" author="26977717@N02" raw="fancy" machine_tag="0">fancy</tag> 25 | <tag id="26957369-3862801353-2073" author="26977717@N02" raw="hotel" machine_tag="0">hotel</tag> 26 | <tag id="26957369-3862801353-5221" author="26977717@N02" raw="5" machine_tag="0">5</tag> 27 | <tag id="26957369-3862801353-2017" author="26977717@N02" raw="star" machine_tag="0">star</tag> 28 | <tag id="26957369-3862801353-6747" author="26977717@N02" raw="rich" machine_tag="0">rich</tag> 29 | <tag id="26957369-3862801353-31915" author="26977717@N02" raw="expensive" machine_tag="0">expensive</tag> 30 | <tag id="26957369-3862801353-786" author="26977717@N02" raw="sports" machine_tag="0">sports</tag> 31 | <tag id="26957369-3862801353-923" author="26977717@N02" raw="car" machine_tag="0">car</tag> 32 | <tag id="26957369-3862801353-2088" author="26977717@N02" raw="Austria" machine_tag="0">austria</tag> 33 | <tag id="26957369-3862801353-22007" author="26977717@N02" raw="plates" machine_tag="0">plates</tag> 34 | <tag id="26957369-3862801353-48298" author="26977717@N02" raw="Lugano" machine_tag="0">lugano</tag> 35 | <tag id="26957369-3862801353-2110" author="26977717@N02" raw="Switzerland" machine_tag="0">switzerland</tag> 36 | </tags> 37 | <urls> 38 | <url type="photopage">http://www.flickr.com/photos/damianmorysfotos/3862801353/</url> 39 | </urls> 40 | </photo> 41 | </rsp> 42 | 43 | -------------------------------------------------------------------------------- /static/dataset/ferrari/white/3087494913_3e61c79038_b.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <rsp stat="ok"> 3 | <photo id="3087494913" secret="3e61c79038" server="3121" farm="4" dateuploaded="1228610838" isfavorite="0" 4 | license="5" safety_level="0" rotation="0" originalsecret="d0b0e6731b" originalformat="jpg" views="1241" 5 | media="photo"> 6 | <owner nsid="29231008@N05" username="CarSpotter" realname="" location="New York" iconserver="3118" 7 | iconfarm="4"/> 8 | <title>599 9 | So gorgeous. Could be the best pic I've ever taken. I really should get a tripod though. 10 | 11 | 12 | 13 | 14 | 15 | 16 | 18 17 | 18 | 19 | 20 | ferrari 21 | fezza 22 | 599 23 | f599 24 | 599gtb 25 | gtb 26 | rare 27 | white 28 | night 29 | new 30 | york 31 | nyc 32 | italian 33 | exotic 34 | 25 35 | second 36 | shutter 37 | 38 | 39 | http://www.flickr.com/photos/carspotter/3087494913/ 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /util/pyleargist-2.0.5/PKG-INFO: -------------------------------------------------------------------------------- 1 | Metadata-Version: 1.0 2 | Name: pyleargist 3 | Version: 2.0.5 4 | Summary: GIST Image descriptor for scene recognition 5 | Home-page: http://www.bitbucket.org/ogrisel/pyleargist/src/tip/ 6 | Author: Olivier Grisel 7 | Author-email: olivier.grisel@ensta.org 8 | License: PSL 9 | Description: Python Wrapper for the LEAR image descriptor implementation 10 | =========================================================== 11 | 12 | :author: 13 | 14 | Library to compute GIST global image descriptors to be used to compare pictures 15 | based on their content (to be used global scene recognition and categorization). 16 | 17 | The GIST image descriptor theoritical definition can be found on A. Torralba's 18 | page: http://people.csail.mit.edu/torralba/code/spatialenvelope/ 19 | 20 | The source code of the C implementation is included in the ``lear_gist`` 21 | subfolder. See http://lear.inrialpes.fr/software for the original project 22 | information. 23 | 24 | pyleargist is licensed under the GPL, the same license as the original C 25 | project. 26 | 27 | 28 | Install 29 | ------- 30 | 31 | Install libfftw3 with development headers (http://www.fftw.org), python dev 32 | headers, gcc, the Python Imaging Library (PIL) and numpy. 33 | 34 | Build locally for testing:: 35 | 36 | % python setup.py buid_ext -i 37 | % export PYTHONPATH=`pwd`/src 38 | 39 | Build and install system wide:: 40 | 41 | % python setup.py build 42 | % sudo python setup.py install 43 | 44 | 45 | Usage 46 | ----- 47 | 48 | Here is a sample session in a python shell once the library is installed:: 49 | 50 | >>> from PIL import Image 51 | >>> import leargist 52 | 53 | >>> im = Image.open('lear_gist/ar.ppm') 54 | >>> descriptors = leargist.color_gist(im) 55 | 56 | >>> descriptors.shape 57 | (960,) 58 | 59 | >>> descriptors.dtype 60 | dtype('float32') 61 | 62 | >>> descriptors[:4] 63 | array([ 0.05786307, 0.19255637, 0.09331483, 0.06622448], dtype=float32) 64 | 65 | 66 | The GIST descriptors (fixed size, 960 by default) can then be used as an 67 | euclidian space to cluster images based on their content. 68 | 69 | This dimension can then be reduced to a 32 or 64 bits semantic hash by using 70 | Locality Sensitive Hashing, Spectral Hashing or Stacked Denoising Autoencoders. 71 | 72 | A sample implementation of picture semantic hashing with SDAs is showcased in 73 | the libsgd library: http://code.oliviergrisel.name/libsgd 74 | 75 | Changes 76 | ------- 77 | 78 | - 1.1.0: 2010/03/25 - fix segmentation fault bug, thx to S. Campion 79 | 80 | - 1.0.1: 2009/10/10 - added missing missing MANIFEST 81 | 82 | - 1.0.0: 2009/10/10 - initial release 83 | 84 | 85 | Keywords: image-processing computer-vision scene-recognition 86 | Platform: UNKNOWN 87 | -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/4720646644_b06a86728f_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | 458 Italia. 9 | Gorgeous profile. 10 | 11 | 12 | 13 | 14 | 15 | 20 16 | 17 | 18 | 19 | ferrari 20 | 458 21 | italia 22 | baby 23 | enzo 24 | exotic 25 | sports 26 | car 27 | fast 28 | yellow 29 | giallo 30 | cars 31 | croissants 32 | new 33 | jersey 34 | wall 35 | white 36 | blank 37 | 38 | 39 | http://www.flickr.com/photos/damianmorysfotos/4720646644/ 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/3554098553_b2bd77c6d9_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 7 | Ferarri F355 Berlinetta 8 | Beautiful F355 Berlinetta spotted in Alexandria, Virginia. The owner (along with his counterpart in 9 | a 348 TS) was kind enough to pass by twice and give a couple of revs. 10 | 11 | 12 | 13 | 14 | 15 | 16 | 2 17 | 18 | 19 | 20 | ferrari 21 | red 22 | targa 23 | 2door 24 | 2seater 25 | 348 26 | 348ts 27 | alexandria 28 | virginia 29 | exotic 30 | supercar 31 | rare 32 | luxury 33 | fast 34 | 355 35 | berlinetta 36 | yellow 37 | 38 | 39 | http://www.flickr.com/photos/27665395@N05/3554098553/ 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /util/pyleargist-2.0.5/src/pyleargist.egg-info/PKG-INFO: -------------------------------------------------------------------------------- 1 | Metadata-Version: 1.0 2 | Name: pyleargist 3 | Version: 2.0.5 4 | Summary: GIST Image descriptor for scene recognition 5 | Home-page: http://www.bitbucket.org/ogrisel/pyleargist/src/tip/ 6 | Author: Olivier Grisel 7 | Author-email: olivier.grisel@ensta.org 8 | License: PSL 9 | Description: Python Wrapper for the LEAR image descriptor implementation 10 | =========================================================== 11 | 12 | :author: 13 | 14 | Library to compute GIST global image descriptors to be used to compare pictures 15 | based on their content (to be used global scene recognition and categorization). 16 | 17 | The GIST image descriptor theoritical definition can be found on A. Torralba's 18 | page: http://people.csail.mit.edu/torralba/code/spatialenvelope/ 19 | 20 | The source code of the C implementation is included in the ``lear_gist`` 21 | subfolder. See http://lear.inrialpes.fr/software for the original project 22 | information. 23 | 24 | pyleargist is licensed under the GPL, the same license as the original C 25 | project. 26 | 27 | 28 | Install 29 | ------- 30 | 31 | Install libfftw3 with development headers (http://www.fftw.org), python dev 32 | headers, gcc, the Python Imaging Library (PIL) and numpy. 33 | 34 | Build locally for testing:: 35 | 36 | % python setup.py buid_ext -i 37 | % export PYTHONPATH=`pwd`/src 38 | 39 | Build and install system wide:: 40 | 41 | % python setup.py build 42 | % sudo python setup.py install 43 | 44 | 45 | Usage 46 | ----- 47 | 48 | Here is a sample session in a python shell once the library is installed:: 49 | 50 | >>> from PIL import Image 51 | >>> import leargist 52 | 53 | >>> im = Image.open('lear_gist/ar.ppm') 54 | >>> descriptors = leargist.color_gist(im) 55 | 56 | >>> descriptors.shape 57 | (960,) 58 | 59 | >>> descriptors.dtype 60 | dtype('float32') 61 | 62 | >>> descriptors[:4] 63 | array([ 0.05786307, 0.19255637, 0.09331483, 0.06622448], dtype=float32) 64 | 65 | 66 | The GIST descriptors (fixed size, 960 by default) can then be used as an 67 | euclidian space to cluster images based on their content. 68 | 69 | This dimension can then be reduced to a 32 or 64 bits semantic hash by using 70 | Locality Sensitive Hashing, Spectral Hashing or Stacked Denoising Autoencoders. 71 | 72 | A sample implementation of picture semantic hashing with SDAs is showcased in 73 | the libsgd library: http://code.oliviergrisel.name/libsgd 74 | 75 | Changes 76 | ------- 77 | 78 | - 1.1.0: 2010/03/25 - fix segmentation fault bug, thx to S. Campion 79 | 80 | - 1.0.1: 2009/10/10 - added missing missing MANIFEST 81 | 82 | - 1.0.0: 2009/10/10 - initial release 83 | 84 | 85 | Keywords: image-processing computer-vision scene-recognition 86 | Platform: UNKNOWN 87 | -------------------------------------------------------------------------------- /static/dataset/ferrari/red/4812805891_26529709c4_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | Ferrari 250 GTO - 24h Le Mans 9 | 1:18 model by Kyosho. 10 | It's amazing how beautiful and detailed this model is. It's letting me do macro pictures without any hassle! 11 | 12 | 13 | 14 | 15 | 16 | 17 | 11 18 | 19 | 20 | 21 | ferrari 22 | 250 23 | gto 24 | lemans 25 | red 26 | 24 27 | 118 28 | model 29 | car 30 | diecast 31 | kyosho 32 | 33 | 35 | Chamberi 36 | Madrid 37 | Madrid 38 | Madrid 39 | Spain 40 | 41 | 42 | 43 | http://www.flickr.com/photos/mrzeon/4812805891/ 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /static/dataset/ferrari/white/5550000906_9c68670383_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 7 | 8 | <description/> 9 | <visibility ispublic="1" isfriend="0" isfamily="0"/> 10 | <dates posted="1300795581" taken="2011-03-20 00:00:13" takengranularity="0" lastupdate="1317771498"/> 11 | <editability cancomment="0" canaddmeta="0"/> 12 | <publiceditability cancomment="1" canaddmeta="0"/> 13 | <usage candownload="1" canblog="0" canprint="0" canshare="1"/> 14 | <comments>1</comments> 15 | <notes/> 16 | <people haspeople="0"/> 17 | <tags> 18 | <tag id="22133040-5550000906-627359" author="22154370@N07" raw="458" machine_tag="0">458</tag> 19 | <tag id="22133040-5550000906-3442" author="22154370@N07" raw="italia" machine_tag="0">italia</tag> 20 | <tag id="22133040-5550000906-9505" author="22154370@N07" raw="ferrari" machine_tag="0">ferrari</tag> 21 | <tag id="22133040-5550000906-3390" author="22154370@N07" raw="track" machine_tag="0">track</tag> 22 | <tag id="22133040-5550000906-3511" author="22154370@N07" raw="day" machine_tag="0">day</tag> 23 | <tag id="22133040-5550000906-1284" author="22154370@N07" raw="race" machine_tag="0">race</tag> 24 | <tag id="22133040-5550000906-9862" author="22154370@N07" raw="racing" machine_tag="0">racing</tag> 25 | <tag id="22133040-5550000906-5981" author="22154370@N07" raw="garage" machine_tag="0">garage</tag> 26 | <tag id="22133040-5550000906-205527" author="22154370@N07" raw="nismo" machine_tag="0">nismo</tag> 27 | <tag id="22133040-5550000906-3820" author="22154370@N07" raw="nissan" machine_tag="0">nissan</tag> 28 | <tag id="22133040-5550000906-79048" author="22154370@N07" raw="zed" machine_tag="0">zed</tag> 29 | <tag id="22133040-5550000906-48862" author="22154370@N07" raw="zeta" machine_tag="0">zeta</tag> 30 | <tag id="22133040-5550000906-49568" author="22154370@N07" raw="lancer" machine_tag="0">lancer</tag> 31 | <tag id="22133040-5550000906-57285" author="22154370@N07" raw="mitsubishi" machine_tag="0">mitsubishi</tag> 32 | <tag id="22133040-5550000906-3329" author="22154370@N07" raw="interiors" machine_tag="0">interiors</tag> 33 | <tag id="22133040-5550000906-227" author="22154370@N07" raw="red" machine_tag="0">red</tag> 34 | <tag id="22133040-5550000906-395" author="22154370@N07" raw="white" machine_tag="0">white</tag> 35 | <tag id="22133040-5550000906-472" author="22154370@N07" raw="black" machine_tag="0">black</tag> 36 | <tag id="22133040-5550000906-1994" author="22154370@N07" raw="grey" machine_tag="0">grey</tag> 37 | <tag id="22133040-5550000906-294" author="22154370@N07" raw="b&w" machine_tag="0">bw</tag> 38 | </tags> 39 | <urls> 40 | <url type="photopage">http://www.flickr.com/photos/bio84/5550000906/</url> 41 | </urls> 42 | </photo> 43 | </rsp> 44 | 45 | -------------------------------------------------------------------------------- /static/dataset/ferrari/red/4105670373_07961469ca_b.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <rsp stat="ok"> 3 | <photo id="4105670373" secret="07961469ca" server="2743" farm="3" dateuploaded="1258305224" isfavorite="0" 4 | license="4" safety_level="0" rotation="0" originalsecret="be4552b02c" originalformat="jpg" views="471" 5 | media="photo"> 6 | <owner nsid="26977717@N02" username="Damian Morys Foto" realname="Damian Morys" 7 | location="New York City, United States" iconserver="3129" iconfarm="4"/> 8 | <title>Scud. 9 | Ferrari Red. 10 | 11 | 12 | 13 | 14 | 15 | 9 16 | 17 | 18 | 19 | ferrari 20 | f430 21 | scuderia 22 | coupe 23 | light 24 | weight 25 | super 26 | car 27 | track 28 | red 29 | rossa 30 | italian 31 | italy 32 | maranello 33 | long 34 | island 35 | new 36 | york 37 | enzo 38 | 39 | 40 | http://www.flickr.com/photos/damianmorysfotos/4105670373/ 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /static/dataset/ferrari/yellow/4718960846_a63298e483_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | 458 Italia. 9 | One of the first to be delivered in the US, absolutely stunning car in person. 10 | 11 | 12 | 13 | 14 | 15 | 16 16 | 17 | 18 | Racing seats = Good 19 | 20 | 21 | Racing seats = A Good Thing 22 | 23 | 24 | 25 | 26 | ferrari 27 | 458 28 | italia 29 | baby 30 | enzo 31 | new 32 | exotic 33 | sports 34 | car 35 | fast 36 | yellow 37 | giallo 38 | cars 39 | croissants 40 | jersey 41 | 42 | 43 | http://www.flickr.com/photos/damianmorysfotos/4718960846/ 44 | 45 | 46 | 47 | 48 | --------------------------------------------------------------------------------