Giter Club home page Giter Club logo

kcfpy's People

Contributors

uoip 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

kcfpy's Issues

multi-target tracking

I ran the code, it can track single-target, how to improve the code to achieve multi-target tracking

I think the code has some question in ' def getFeature()'

def getFeatures(self, image, inithann, scale_adjust=1.0):
	extracted_roi = [0,0,0,0]   #[int,int,int,int]
	cx = self._roi[0] + self._roi[2]/2  #float
	cy = self._roi[1] + self._roi[3]/2  #float

	if(inithann):
		padded_w = self._roi[2] * self.padding
		padded_h = self._roi[3] * self.padding

		if(self.template_size > 1):
			if(padded_w >= padded_h):
				self._scale = padded_w / float(self.template_size)
			else:
				self._scale = padded_h / float(self.template_size)
			self._tmpl_sz[0] = int(padded_w / self._scale)
			self._tmpl_sz[1] = int(padded_h / self._scale)
		else:
			self._tmpl_sz[0] = int(padded_w)
			self._tmpl_sz[1] = int(padded_h)
			self._scale = 1.

		if(self._hogfeatures):
			self._tmpl_sz[0] = int(self._tmpl_sz[0]) / (2*self.cell_size) * 2*self.cell_size + 2*self.cell_size
			self._tmpl_sz[1] = int(self._tmpl_sz[1]) / (2*self.cell_size) * 2*self.cell_size + 2*self.cell_size
		else:
			self._tmpl_sz[0] = int(self._tmpl_sz[0]) / 2 * 2
			self._tmpl_sz[1] = int(self._tmpl_sz[1]) / 2 * 2

	extracted_roi[2] = int(scale_adjust * self._scale * self._tmpl_sz[0])
	extracted_roi[3] = int(scale_adjust * self._scale * self._tmpl_sz[1])
	extracted_roi[0] = int(cx - extracted_roi[2]/2)
	extracted_roi[1] = int(cy - extracted_roi[3]/2)

	z = subwindow(image, extracted_roi, cv2.BORDER_REPLICATE)
	if(z.shape[1]!=self._tmpl_sz[0] or z.shape[0]!=self._tmpl_sz[1]):
		z = cv2.resize(z, tuple(self._tmpl_sz))

	if(self._hogfeatures):
		mapp = {'sizeX':0, 'sizeY':0, 'numFeatures':0, 'map':0}
		mapp = fhog.getFeatureMaps(z, self.cell_size, mapp)
		mapp = fhog.normalizeAndTruncate(mapp, 0.2)
		mapp = fhog.PCAFeatureMaps(mapp)
		self.size_patch = map(int, [mapp['sizeY'], mapp['sizeX'], mapp['numFeatures']])
		FeaturesMap = mapp['map'].reshape((self.size_patch[0]*self.size_patch[1], self.size_patch[2])).T   # (size_patch[2], size_patch[0]*size_patch[1])
	else:
		if(z.ndim==3 and z.shape[2]==3):
			FeaturesMap = cv2.cvtColor(z, cv2.COLOR_BGR2GRAY)   # z:(size_patch[0], size_patch[1], 3)  FeaturesMap:(size_patch[0], size_patch[1])   #np.int8  #0~255
		elif(z.ndim==2):
			FeaturesMap = z   #(size_patch[0], size_patch[1]) #np.int8  #0~255
		FeaturesMap = FeaturesMap.astype(np.float32) / 255.0 - 0.5
		self.size_patch = [z.shape[0], z.shape[1], 1]

	if(inithann):
		self.createHanningMats()  # createHanningMats need size_patch

	FeaturesMap = self.hann * FeaturesMap
	return FeaturesMap

What will change it will do to my systerm if I install KCFcpp-py-wrapper ?

Dear uoip:
First of all, thanks for your work very much. You write a python wrapper for KCFcpp. I want to make use of it. But I have a question that what kind of change will python setup.py build_ext --inplace will have on my systerm? How can I withdraw the changes?
I am new to github. I cannot find the issues column in the uoip/KCFcpp-py-wrapper, so I asked here. Looking forward to get your response ^_^

I have question about the KCFcpp-py-wrapper ,how can I find the target wether lost?

I konw the opencv API have the flag .
such as --> retval, boundingBox = cv.Tracker.update( image )
the flag is retval to find the object wehter lost .

-->Problem ONE :
but the API has a big disadvantages that it cant re-init the Tracker(in other word ,we cant init a tracker 2 times ).
And I need the function (re-init ),so i must use the kcf (joaofaro/KCFcpp),this code has the function ,we can init the Tracker many times.

-->Problem TWO :
so can you give me some advice for how to use the peak_value (just like use the flag in opencv API )?

-->Problem THREE :
uoip/KCFcpp-py-wrapper
I use the python kcf wrappered from c++ kcf ( joao .f).
do you have any good ideas about how can I find the target wether lost?

Some Question related to program logic

Thanks a lot for great code, I still have some questions
Does it use SVM?
What is the “peak value” returned and what is its range?
where actually it look in the new frame for the object?

I believe there are some bugs in the code

in kcftracker.py:
209-213 should be to make sure self._tmpl_sz can be divisible by self.cell_size:
if(self._hogfeatures):
self._tmpl_sz[0] = int(self._tmpl_sz[0] / (2self.cell_size)) * 2self.cell_size + 2self.cell_size
self._tmpl_sz[1] = int(self._tmpl_sz[1] / (2
self.cell_size)) * 2self.cell_size + 2self.cell_size
else:
self._tmpl_sz[0] = int(self._tmpl_sz[0] / 2) * 2
self._tmpl_sz[1] = int(self._tmpl_sz[1] / 2) * 2

TypeError: 'map' object is not subscriptable

Traceback (most recent call last):
File "run.py", line 75, in
tracker.init([ix,iy,w,h], frame)
File "/home/hp/zjc/nk_PyCharm/PyCharm_project/nk_KCF/3_uoip-KCFpy
/KCFpy/kcftracker.py", line 269, in init
self._tmpl = self.getFeatures(image, 1)
File "/home/hp/zjc/nk_PyCharm/PyCharm_project/nk_KCF/3_uoip-KCFpy
/KCFpy/kcftracker.py", line 185, in getFeatures
cx = self._roi[0] + self._roi[2]/2 #float
TypeError: 'map' object is not subscriptable

AssertionError

hello,when i change the code designed by python2 to python3 ,there is the following ploblem:

assert(cutWindow[2]>0 and cutWindow[3]>0)
AssertionError

So,how can i deal with this problem?
thank you!
QQ图片20200713212800

The gap between KCFcpp and KCFpy?

I have run your code, but I found the performance has some gap between these cpp and py version.

1. the cpp version has a better scale invariance
2. the py version is easily tend to lose target

and I still run some other version of cpp code such as vojirt/kcf and foolwood/KCF, they remain the same problems.

Do you have worked out this weird problem?

A bug about @jit decorator in numba.

Hello, I met a problem when running the code as follows:TypeError: _jit_decorator() takes exactly 1 argument (7 given). But I have checked the fhog.py and find the func1 does provide 7 arguments. Does anybody have some idea and help me?

slice indices must be integers

Traceback (most recent call last):
File "/Users/guomuqi/Downloads/KCFpy-master/run.py", line 75, in
tracker.init([ix,iy,w,h], frame)
File "/Users/guomuqi/Downloads/KCFpy-master/kcftracker.py", line 274, in init
self.train(self.tmpl, 1.0)
File "/Users/guomuqi/Downloads/KCFpy-master/kcftracker.py", line 261, in train
k = self.gaussianCorrelation(x, x)
File "/Users/guomuqi/Downloads/KCFpy-master/kcftracker.py", line 171, in gaussianCorrelation
c = rearrange(c)
File "/Users/guomuqi/Downloads/KCFpy-master/kcftracker.py", line 38, in rearrange
img
[0:yh,0:xh], img_[yh:img.shape[0],xh:img.shape[1]] = img[yh:img.shape[0],xh:img.shape[1]], img[0:yh,0:xh]
TypeError: slice indices must be integers or None or have an index method

Did anyone else run into this problem?

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.