by

## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
##### Activity
Nicolas DUBIEN
@dubzzz

Unexpected behaviour in DalalTriggsHOGdescriptor from repository menpo/menpo??

Line 294: block(double *) is set to 0.
Line 413: the loop can change the value of block[i][j][k]

We can imagine that for a given value of (x, y), block[i][j][k] is modified at line 426
But that for another value (after) (x', y'), block[i][j][k] is not modified (no else statement)
That means that the value of block[i][j][k] will not be the one corresponding to this (x', y') (and not 0.) but will still be taken into account for the remaining part of the process.

Is it really the expected behaviour ?

James Booth
@jabooth
1. what’s wrong with nosetests ./menpo/image/test/image_features_test.py? You could configure your IDE to run these tests, or write a trivial Makefile. There is no more automated way than the above command though.
2 - Let’s discuss the meeting via email (will respond in a mo)
James Booth
@jabooth
3 - really keen to meet up and discuss the progress you have already made. It would be good if you could brief us in that meeting about how you are looking to integrate CUDA with Python - this is a key design decision so something I want to get right. Once we are all happy I’d like to see a PR adding CUDA support to Menpo (or perhaps onto a special cuda branch for the time being) so we can move forward with small PR’s adding new CUDA functionality.
4 - Questions about the HOG implementation are best handled by @nontas who wrote the code - I’ll ask him to get back to you. Unfortunately he has injured his hand recently so might be out of action for a day or two!
Nicolas DUBIEN
@dubzzz
1. done, I finally find how to use nosetests to carry out tests on image/features
2. for the meeting I'm available whenever you want this week and next week. The sooner the better as it will help me to know what to do, how to test precisely..
3. for the moment I created a file called HOG.cu to replace HOG.cpp. It contains a basic implementation of HOG algorithms in CUDA. I still need to check that the output remains the same as the one you get with your version but it compiles and passes tests.
4. for questions on HOG I will refer to @nontas . Hope that your hand is going better
See you soon ^^
Epameinondas Antonakos
@nontas
Hey @dubzzz ! Sorry for the late reply...

1) In general, a rational value for cellHeightAndWidthInPixels parameter would be an integer in the region [2,16]. However, we mostly use the default value, which is 8. I think you should focus on that case.

2) Regarding your HOG::ZhuRamananHOGdescriptor at line 87 in HOG.cppcomment: this code is not written by me; it's Zhu & Ramanan's code as noted in thelicense_ZhuRamananHOGdescriptor.txt file. So I've never actually went through the code and I don't really recommend to change it. However, your comment is indeed interesting and we could discuss it in person if you want.

3) The same stands for your DalalTriggsHOGdescriptor question. The code again is not mine, however your observation is totally correct. In order to solve this, we can consider as a fact that blockNorm = sqrt(blockNorm) will only return a number greater or equal to zero. Thus, if blockNorm > 0, the block[i][j][k] should take the value it takes now. If blockNorm == 0 (else case), block[i][j][k] will be infinite and then it must be clipped to the l2normClipping parameter value. So from line 425:

if (blockNorm > 0) {
block[i][j][k] = h[y+i][x+j][k] / blockNorm;
if (block[i][j][k] > l2normClipping)
block[i][j][k] = l2normClipping;
}
else
block[i][j][k] = l2normClipping;

or something similar.

These were good remarks Nicolas. I will be in the meeting on Monday, so we can further discuss them and we should consider making the changes to the original menpo code.

Joan Alabort-i-Medina
@jalabort
from menpo.fitmultilevel.aam import AAMBuilder
from menpo.image.feature.features import hog_cuda

def my_hogs(image):
hog_pixels = hog_cuda(image.pixels, mode='dense')
hog_img.landmarks = image.landmarks
return hog_img

# build AAM
aam = AAMBuilder(feature_type=my_hogs, normalization_diagonal=100, n_levels=1).build(training_images, verbose=True)
from menpo.fitmultilevel.aam import LucasKanadeAAMFitter

# define Lucas-Kanade based AAM fitter
fitter = LucasKanadeAAMFitter(aam, n_shape=0.9, n_appearance=0.9)
Epameinondas Antonakos
@nontas
Obtaining file:///home/nontas/Documents/Research/menpo
Running setup.py egg_info for package from file:///home/nontas/Documents/Research/menpo
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "/home/nontas/Documents/Research/menpo/setup.py", line 23, in <module>
cython_exts = cythonize(cython_modules, quiet=True)
File "/usr/lib/pymodules/python2.7/Cython/Build/Dependencies.py", line 468, in cythonize
aliases=aliases)
File "/usr/lib/pymodules/python2.7/Cython/Build/Dependencies.py", line 452, in create_extension_list
**kwds))
TypeError: Extension constructor got multiple values for keyword argument 'sources'
Complete output from command python setup.py egg_info:
Traceback (most recent call last):

File "<string>", line 14, in <module>

File "/home/nontas/Documents/Research/menpo/setup.py", line 23, in <module>

cython_exts = cythonize(cython_modules, quiet=True)

File "/usr/lib/pymodules/python2.7/Cython/Build/Dependencies.py", line 468, in cythonize

aliases=aliases)

File "/usr/lib/pymodules/python2.7/Cython/Build/Dependencies.py", line 452, in create_extension_list

**kwds))

TypeError: Extension constructor got multiple values for keyword argument 'sources'

----------------------------------------
Command python setup.py egg_info failed with error code 1 in /home/nontas/Documents/Research/menpo
Storing complete log in /home/nontas/.pip/pip.log
James Booth
@jabooth
/usr/lib/pymodules/python2.7/Cython/Build/Dependencies.py
means you aren't in conda
run which pip
Epameinondas Antonakos
@nontas
/home/nontas/miniconda/envs/menpo/bin/pip
James Booth
@jabooth
ok, looks good
and you ran conda create -n menpo python
to create an env right?
Epameinondas Antonakos
@nontas
yup
I am actually in the conda env cause it appearse in front of the command line
James Booth
@jabooth
and the installation command you ran?
pip install... can you paste it here?
Epameinondas Antonakos
@nontas
pip install --no-deps -e ./menpo
James Booth
@jabooth
run ipython
import cython
cython.__file__`
check where that is?
Epameinondas Antonakos
@nontas
'/home/nontas/miniconda/envs/menpo/lib/python2.7/site-packages/cython.pyc'
James Booth
@jabooth
try just opening a fresh terminal
then
source activate menpo
and try the pip install again?
Epameinondas Antonakos
@nontas
ok it worked!!
hahaha
James Booth
@jabooth
ha!
Epameinondas Antonakos
@nontas
thanks for the help buddy!
James Booth
@jabooth
yeah I've had it where pip is not updated to point to the conda command immediately after install
so you have to reload the conda env to get it to take
Epameinondas Antonakos
@nontas
I see
James Booth
@jabooth
but with us doing which pip and getting the right answer I was convinced it couldn't be that haha
Epameinondas Antonakos
@nontas
haha
actually it's always the old classic engineering solution to all problems: Restart!
hahaha
James Booth
@jabooth
ha exactly mate! :clap:
vprooks
@vprooks
Hello! How can I save a trained DlibERT model on disk?
the example for pickling doesn't seem to work :(
Mohamed Elwakdy
@Elwakdy_gitlab

Hi Everybody,

I am using windows 7. I installed numpy, and cython before installing "menpo". When I tried to to install "menpo" by pip install menpo. , I have received this error:

Command "c:\users\user\appdata\local\programs\python\python36\python.exe -u -c "
import setuptools, tokenize;file='C:\Windows\TEMP\pip-install-5ms4i27p\s
e('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --recor
d C:\Windows\TEMP\pip-record-dnp0vu9w\install-record.txt --single-version-extern
ally-managed --compile" failed with error code 1 in C:\Windows\TEMP\pip-install-
5ms4i27p\scipy\

I need your help to fix this error.

Mohamed Elwakdy
@Elwakdy_gitlab