Code Monkey home page Code Monkey logo

bag-of-visual-words-python's Introduction

Bag-of-Visual-Words-Python

This repo is no longer maintained

This repository has been archived. It's just for learning purposes and will not be fixing issues / versioning / accepting PRs. Thanks for viewing the code / blog post!

This is a python implementation of the Bag of Visual Words model. Be sure to check it out on my blog

Project Architecture :

:::python 
- root dir/
	|- images/
			|- test /
				|- obj1/
				|- obj2/

			|- train /
				|- obj1/
				|- obj2/

	|- helpers.py
	|- Bag.py 


:~$ python Bag.py --train_path images/train/ --test_path images/test/

Output

im1 im2 im3 im4 im5 im5

NOTE: I've added the MIT LICENSE to the repo. Anyone is free to use this code in accordance with the MIT LICENSE

bag-of-visual-words-python's People

Contributors

kushalvyas avatar pabloheimplatz avatar pedrocolon93 avatar williamyi96 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

bag-of-visual-words-python's Issues

Why model classifying in images into two classes. I want multi class classification.

I am trying this model on multiclass classification. My trained dataset contains four folders Happy, Sad, Neutral, Angry. The first problem it's reading every image from all folder when it is going to read angry or any other label image and second it's not taking the two labels only angry and sad it's taking not other two.
Can anyone help me with that?
Eagerly waiting for the solution.

Warnings

I don't know why but i am getting a lot of deprecated warnings.

ValueError: all the input array dimensions except for the concatenation axis must match exactly

Can you please please help to this error

File "Bag.py", line 160, in
bov.trainModel()
File "Bag.py", line 50, in trainModel
bov_descriptor_stack = self.bov_helper.formatND(self.descriptor_list)
File "/home/ram/RAM/From 11-June-2018/1.Image_classification/Bag-of-Visual-Words-Python/helpers.py", line 87, in formatND
vStack = np.vstack((vStack, remaining))
File "/home/ram/anaconda3/envs/pytorch/lib/python2.7/site-packages/numpy/core/shape_base.py", line 234, in vstack
return _nx.concatenate([atleast_2d(_m) for _m in tup], 0)
ValueError: all the input array dimensions except for the concatenation axis must match exactly

IndexError: list index out of range

Traceback (most recent call last):
  File "Bag.py", line 160, in <module>
    bov.trainModel()
  File "Bag.py", line 50, in trainModel
    bov_descriptor_stack = self.bov_helper.formatND(self.descriptor_list)
  File "C:\Users\birdman\OneDrive\Project\MY STUFFS\bag of visual word\Bag-of-Visual-Words-Python-master\Bag-of-Visual-Words-Python-master\helpers.py", line 85, in formatND
    vStack = np.array(l[0])
IndexError: list index out of range

Using code in master thesis

Hello!

I am a medical engineering student studying in Germany. I am trying to implement a similar problem for my master thesis and this code is almost exactly what I want to do. Is it permissible to use this code? It would be really helpful if you can let me know how I can cite you, the author for this code.

Thank you in advance.
Best Regards,
Gayathri

运行出错

你好,我下载了您的代码,但是运行的时候,Bag.py
for word, imlist in self.images.items():
self.name_dict[str(label_count)] = word
print("Computing Features for ", word)
print(imlist)
for im in imlist:

这里由于python3,我改成了items(),但是imlist传进来是个空的,请问这是怎么回事呢?
我很着急,能麻烦您跟我联系一下么?

test_path and train_path arguments bugs

File "Bag.py", in 140, 141:
parser.add_argument('--train_path', action="store", dest="train_path", required=True)
parser.add_argument('--test_path', action="store", dest="test_path", required=True)
but in the instruction README.md file, it shows:
python Bag.py --train_set images/train/ --test_set images/test/

Need to change 'python Bag.py --train_set images/train/ --test_set images/test/' to 'python Bag.py --train_path images/train/ --test_path images/test/' in README.md to make to work properly.

Thanks.

For Windows User

  • Use the following code in helpers.py if the system is windows
  • Otherwise the "\" notation for windows will create problems
#line number 139
for each in glob("{}/*".format(path)):
	key = each.split("/")[-1]
	key = key.split("\\""")[-1]
	print(" #### Reading image category ", key, " ##### ")
	imlist[key] = []
	for imagefile in glob(path+key+"/*.jpg"):
		print("Reading file ", imagefile)
		im = cv2.imread(imagefile)
		imlist[key].append(im)
		count +=1

licence for master thesis

Hi Kushal,
I have a simliar problem (but with a completely different dataset) in my master thesis. (I'm also studying computer science here in Germany) And it would be perfect if I can quote and use some of your code ideas in my own master thesis. So I would ask, if it is possible that you add an licence (just for usage in science) in your repository?

Thank you in advance.
Best Regards,
Pablo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.