Giter Site home page Giter Site logo

object-detector's People

Contributors

bikz05 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  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

object-detector's Issues

Training our own dataset

Hello. Currently new to python and working in our senior's project. I find this HOG suited in our objectives with the integration of svm. But my main problem is how I would able to train our own dataset. can you give us idea on how to train our own datasets? Thank you!

LinearSVC fit error

Hi,
I keep getting: ValueError: setting an array element with a sequence.
When the line: clf.fit(fds, labels) tries to run.
Do you have any idea what am I doing wrong?

Thanks in advance

AttributeError: module 'sklearn.externals.joblib.numpy_pickle' has no attribute 'NumpyArrayWrapper'

clf = joblib.load(model_path)
File "C:\Program Files\Anaconda3\lib\site-packages\sklearn\externals\joblib\numpy_pickle.py", line 459, in load
obj = unpickler.load()
File "C:\Program Files\Anaconda3\lib\pickle.py", line 1039, in load
dispatchkey[0]
File "C:\Program Files\Anaconda3\lib\pickle.py", line 1334, in load_global
klass = self.find_class(module, name)
File "C:\Program Files\Anaconda3\lib\pickle.py", line 1388, in find_class
return getattr(sys.modules[module], name)
AttributeError: module 'sklearn.externals.joblib.numpy_pickle' has no attribute 'NumpyArrayWrapper'

How to run test-object-detector file?

When running "test-object-detector" line in terminal, it's not successful. :(. Error: "test-object-detector: command not found". I changed name to test-object-detector.py to run but not success with error: "../data/dataset/CarData.tar.gz: No such file or directory
tar (child): ../data/dataset/CarData.tar.gz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
Traceback (most recent call last):
File "../object-detector/extract-features.py", line 5, in
from sklearn.externals import joblib
ImportError: No module named sklearn.externals
Traceback (most recent call last):
File "../object-detector/train-classifier.py", line 3, in
from sklearn.svm import LinearSVC
ImportError: No module named sklearn.svm
Traceback (most recent call last):
File "../object-detector/test-classifier.py", line 5, in
from sklearn.externals import joblib
ImportError: No module named sklearn.externals"

Help me! thanks

Error when training: ValueError: setting an array element with a sequence.

I was running test-object-detector in bin.
It gives me following error:

Training a Linear SVM Classifier
Traceback (most recent call last):
File "../object-detector/train-classifier.py", line 48, in
clf.fit(list(np.array(fds)), labels)
File "/usr/local/lib/python2.7/dist-packages/sklearn/svm/base.py", line 151, in fit
X, y = check_X_y(X, y, dtype=np.float64, order='C', accept_sparse='csr')
File "/usr/local/lib/python2.7/dist-packages/sklearn/utils/validation.py", line 521, in check_X_y
ensure_min_features, warn_on_dtype, estimator)
File "/usr/local/lib/python2.7/dist-packages/sklearn/utils/validation.py", line 382, in check_array
array = np.array(array, dtype=dtype, order=order, copy=copy)
ValueError: setting an array element with a sequence.

Please fix this issue.

object-detector/object-detector/nms.py

for index, detection in enumerate(detections):
        for new_detection in new_detections:
            if overlapping_area(detection, new_detection) > threshold:
                del detections[index]
                break
        else:
            new_detections.append(detection)
            del detections[index]

changes to iterator will not work - nms produces:

detections = [[10, 10, .12, 10, 10], [50, 50, .8,10, 10], [100, 100, 0.9, 10, 10]]
print ("Detections before NMS = {}".format(detections))
print ("Detections after NMS = {}".format(nms(detections)))

Detections before NMS = [[10, 10, 0.12, 10, 10], [50, 50, 0.8, 10, 10], [100, 100, 0.9, 10, 10]]
Detections after NMS = [[100, 100, 0.9, 10, 10], [50, 50, 0.8, 10, 10]]

e.g. change to:

while len(detections) > 0:
    detection = detections.pop()
    for new_detection in new_detections:
        if overlapping_area(detection, new_detection) > threshold:
            break
    else:
        new_detections.append(detection)
detections = [[10, 10, .12, 10, 10], [50, 50, .8,10, 10], [100, 100, 0.9, 10, 10]]
print ("Detections before NMS = {}".format(detections))
print ("Detections after NMS = {}".format(nms(detections)))

Detections before NMS = [[10, 10, 0.12, 10, 10], [50, 50, 0.8, 10, 10], [100, 100, 0.9, 10, 10]]
Detections after NMS = [[100, 100, 0.9, 10, 10], [10, 10, 0.12, 10, 10], [50, 50, 0.8, 10, 10]]

Unable to pass parameters to clf.train() method

Everything's working fine but I'm unable to debug the below error from past a week. Problem is with clf.tain() method which expects a single dimensional column vector but what we are passing is an array of arrays i.e. fds in your code. Can you please help me in overcoming this issue. I'm very disappointed from past one week.

Positive features saved in ../data/features/pos
Calculating the descriptors for the negative samples and saving them
Negative features saved in ../data/features/neg
Completed calculating features from training images
Training a Linear SVM Classifier
Traceback (most recent call last):
File "../object-detector/train-classifier.py", line 52, in
clf.train(fds,labels)
TypeError: trainData data type = 17 is not supported
Traceback (most recent call last):
File "../object-detector/test-classifier.py", line 68, in
fd = hog(im_window, orientations, pixels_per_cell, cells_per_block, visualize, normalize)
File "/usr/lib/python2.7/dist-packages/skimage/feature/_hog.py", line 63, in hog
raise ValueError("Currently only supports grey-level images")
ValueError: Currently only supports grey-level images

If I print out the contents of fds and labels, below is what I get -

[ array([ 2.47301895e-02, 0.00000000e+00, 0.00000000e+00, ...,
2.10207273e-17, 1.68165818e-17, 0.00000000e+00])
array([ 2.22566842e-03, 5.06294401e-04, 2.59973865e-04, ...,
8.12927905e-05, 5.35716830e-05, 4.41070061e-04])]
[1 0]

As you can see fds is an array of arrays

How to train a new module

Sorry I'm a novice. After I run the test-classifier.py, I got a great result.
Now I want to train the SVM classifier by myself.
I download the UIUC image set that you pose in readme.
Second, I create the pos and neg folder in data/feature folder.
Next, I move the pos- image in TrainImages to pos while neg-image moving to neg image.
So the data folder would like this:

sunner@sunnerPC:~/object-detector/data/fetures$ tree .
.
├── neg
│   ├── neg-0.pgm
│   ├── neg-100.pgm
│   ├── .....(skip the middle)
│   └── neg-9.pgm
└── pos
    ├── pos-0.pgm
    ├── pos-100.pgm
    ├── ......(skip the middle)
    └── pos-9.pgm

While I run the train-classifier.py, I got several harvest.
the pos and neg folder didn't have *.feat file? So I got empty list in fds and labels.
I change *.feat to *.pgm to meet the format of image set, the console dump with:

Traceback (most recent call last):
  File "train-classifier.py", line 31, in <module>
    fd = joblib.load(feat_path)
  File "/usr/local/lib/python2.7/dist-packages/sklearn/externals/joblib/numpy_pickle.py", line 462, in load
    obj = unpickler.load()
  File "/usr/lib/python2.7/pickle.py", line 858, in load
    dispatch[key](self)
  File "/usr/lib/python2.7/pickle.py", line 891, in load_persid
    self.append(self.persistent_load(pid))
AttributeError: NumpyUnpickler instance has no attribute 'persistent_load'

Is some step I got wrong? How can I do next? Please give me some advise.

getting nothig output

Testing started at 1:27 PM ...
Launching unittests with arguments python -m unittest /home/vinudev/Documents/Research work/PrjectSamples/object-detector/object-detector/test-classifier.py in /home/vinudev/Documents/Research work/PrjectSamples/object-detector/object-detector

Ran 0 tests in 0.000s

OK

Process finished with exit code 0
Empty test suite.

Problem when running test-classifier.py

when i run i got this error:

/usr/lib/python2.7/site-packages/sklearn/utils/validation.py:395: DeprecationWarning: Passing 1d arrays as data is deprecated in 0.17 and will raise ValueError in 0.19. Reshape your data either using X.reshape(-1, 1) if your data has a single feature or X.reshape(1, -1) if it contains a single sample.
DeprecationWarning)

(test-classifier.py:19890): Gtk-WARNING **: gtk_disable_setlocale() must be called before gtk_init()

(test-classifier.py:19890): Gtk-CRITICAL **: IA__gtk_type_unique: assertion 'GTK_TYPE_IS_OBJECT (parent_type)' failed

(test-classifier.py:19890): Gtk-CRITICAL **: IA__gtk_type_unique: assertion 'GTK_TYPE_IS_OBJECT (parent_type)' failed

(test-classifier.py:19890): Gtk-CRITICAL **: IA__gtk_type_new: assertion 'GTK_TYPE_IS_OBJECT (type)' failed
zsh: segmentation fault (core dumped) /usr/bin/python2.7 test-classifier.py -i

Any clue??

Please anser the problem of numpy error.

classifier = svm.SVC(gamma=0.001)

classifier.fit(data,targets)
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.5/dist-packages/sklearn/svm/base.py", line 149, in fit
accept_large_sparse=False)
File "/usr/local/lib/python3.5/dist-packages/sklearn/utils/validation.py", line 747, in check_X_y
estimator=estimator)
File "/usr/local/lib/python3.5/dist-packages/sklearn/utils/validation.py", line 522, in check_array
array = np.asarray(array, dtype=object, order=order)
File "/usr/local/lib/python3.5/dist-packages/numpy/core/numeric.py", line 482, in asarray
return array(a, dtype,copy=False, order=order)
ValueError: setting an array element with a sequence.
How can I solve this error?Thanks in advance!

how to run test-classifier.py from direct camera stream

I modifed the test_classfier.py to get live frames from camera and detect object from live camera stream, but am getting this error:
ValueError: The parameter image must be a 2-dimensional array
at this line 👍
fd = hog(im_window, orientations, pixels_per_cell, cells_per_block, visualize, normalize)

here the complete Traceback:

File "../object-detector/cam-classifier.py", line 81, in
fd = hog(im_window, orientations, pixels_per_cell, cells_per_block, visualize, normalize)
File "/usr/lib/python2.7/site-packages/skimage/feature/_hog.py", line 79, in hog
assert_nD(image, 2)
File "/usr/lib/python2.7/site-packages/skimage/_shared/utils.py", line 166, in assert_nD
raise ValueError(msg % (arg_name, '-or-'.join([str(n) for n in ndim])))
ValueError: The parameter image must be a 2-dimensional array

Thanks :)

ValueError:X has 22032 features per sample;expecting 38916

I train my own data on windows,python3.6 , 192 pos images(RGB) and 192 neg images(RGB), size=(192,384)
[hog]
min_wdw_sz: [150, 300]
step_size: [8, 8]
orientations: 9
pixels_per_cell: [8, 8]
cells_per_block: [2, 2]
visualize: False
transform_sqrt:True
[nms]
threshold: 0.3
how to fix it?

ValueError: Expected 2D array, got 1D array instead:

I'm running test-object-detector.py on Windows 10 64bit with python 3.6.3
(added print statement's missing parenthesis)

python successfully downloaded and extracted 'UIUC Image Database for Car Detection'
but i'm getting error here

ValueError: Expected 2D array, got 1D array instead:
array=[].
Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.
Traceback (most recent call last):

how to resolve this issue?

Error During test

Hi!, awesome code.
I'm getting this error during the execution of test-classifier.py:

Traceback (most recent call last):
File "test-classifier.py", line 69, in
pred = clf.predict(fd)
File "/usr/lib/python2.7/dist-packages/sklearn/linear_model/base.py", line 268, in predict
scores = self.decision_function(X)
File "/usr/lib/python2.7/dist-packages/sklearn/linear_model/base.py", line 249, in decision_function
% (X.shape[1], n_features))
ValueError: X has 2430 features per sample; expecting 5184

Is there any correlation with the number of positive and negative samples?

I'm puting 100 Pos images and 13000 Neg images
Resolution: 80X80

Regards!

Error when running extract-features.py

Hello, i have this error message when running extract-features with your configuration "Selected block normalization method is invalid"
do you know how to fix it ?

problem running test-classifier.py

Hi, there is an error when I try to run the code. Can you please give me some suggestions? Thanks a lot!

usage: test-classifier.py [-h] -i IMAGE [-d DOWNSCALE] [-v]
test-classifier.py: error: argument -i/--image is required
An exception has occurred, use %tb to see the full traceback.

SystemExit: 2

C:\ProgramData\Anaconda2\lib\site-packages\IPython\core\interactiveshell.py:2890: UserWarning: To exit: use 'exit', 'quit', or Ctrl-D.
warn("To exit: use 'exit', 'quit', or Ctrl-D.", stacklevel=1)

where and what is your cascade ??

Hi,
I am so lucky to see your code ,but when i run this code in ubuntu16.04 and python3 as you do in the yutube,I was not clearly for the cascade in your commond , look forward your reply,thank you!
Best wishes!!!

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.