https://github.com/oscarlorentzon/repstruct
Python library for finding representative structures in image collections
https://github.com/oscarlorentzon/repstruct
bag-of-visual-words descriptor image-retrieval pca-analysis python
Last synced: 6 months ago
JSON representation
Python library for finding representative structures in image collections
- Host: GitHub
- URL: https://github.com/oscarlorentzon/repstruct
- Owner: oscarlorentzon
- License: other
- Created: 2014-09-29T17:42:18.000Z (over 11 years ago)
- Default Branch: main
- Last Pushed: 2021-02-24T09:53:22.000Z (almost 5 years ago)
- Last Synced: 2025-06-23T19:42:28.162Z (7 months ago)
- Topics: bag-of-visual-words, descriptor, image-retrieval, pca-analysis, python
- Language: Python
- Homepage:
- Size: 4.05 MB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# About repstruct
Repstruct is a python library for finding representative structures in large image collections. It is implemented according to the theory of the Master's thesis [Finding reprensentative structures in large image collections](http://www2.maths.lth.se/vision/education/pages/OscarNils09/) by Oscar Lorentzon and Nils Lundahl.
The results are obtained by an approach using bags of visual words and colors. The implementation extracts SIFT descriptors as well as colors from the images in the collection and creates feature vectors from histograms created by classifying the features against training data. A collection of images is downloaded from Flickr for a specified tag and the results of the algorithm are presented by plotting the group of closest images and then the most representative.
## Running
To be able to download images from [Flickr](https://www.flickr.com/) an API key is required. An API key can be requested from [Flickr's App Garden](https://www.flickr.com/services/apps/create/).
The rsbundler file can be run from the command line in the following way:
bin/run TAG -a FLICKR_API_KEY
The API key can also be provided by adding a text file called flickr_key.txt with the API key in the root of the project. Then the bundler can be run as follows:
bin/run TAG
To view additional bundler options run the bundler with the -h flag:
bin/run -h
## Continuous integration
[](https://travis-ci.org/oscarlorentzon/repstruct)
[](https://coveralls.io/r/oscarlorentzon/repstruct?branch=master)
## Dependencies
You need to have Python 2.7+ and the following libraries to run the algorithm:
* [OpenCV][]
* [SciPy][]
* [NumPy][]
* [Matplotlib][]
* [Enum34][]
* [PyYAML][]
The following libraries are required to run the tests:
* [Setuptools][]
* [Mock][]
* [Nose][]
### Installing dependencies on Ubuntu
1. [OpenCV][] - Install by following the steps in the Ubuntu OpenCV [installation guide](https://help.ubuntu.com/community/OpenCV).
2. [NumPy][], [SciPy][], [PyYAML][], [Enum34][], [Setuptools][], [Mock][], [Nose][] and [Matplotlib][] - Install [pip](https://pypi.python.org/pypi/pip) and run:
sudo apt-get install gfortran
sudo pip install -r requirements.txt
sudo apt-get install python-matplotlib
## Example output
The images below show the result from a run using the tag **steppyramid.** The first output image shows the collection images plotted against their feature vector projection onto the third and fourth principal components.

The second output image shows the result after running the algorithm. On top all collection images are shown, in the middle the thirty closest images are shown and at the bottom the five most representative images are shown.

The third output image shows the result for finding all structures ordered according to a score based on the representative result.

[OpenCV]: http://opencv.org/ (Computer vision and machine learning software library)
[NumPy]: http://www.numpy.org/ (Scientific computing with Python)
[SciPy]: http://www.scipy.org/ (Fundamental library for scientific computing)
[Matplotlib]: http://matplotlib.sourceforge.net (Plotting in python)
[Enum34]: https://pypi.python.org/pypi/enum34 (Enum support in python 2.*)
[PyYAML]: http://pyyaml.org/ (YAML implementations for Python)
[Setuptools]: http://pythonhosted.org/setuptools/ (Python project packaging)
[Mock]: http://www.voidspace.org.uk/python/mock/ (Mocking and testing library)
[Nose]: https://nose.readthedocs.org/en/latest/ (Unit test extensions)