yolomex is a simple Matlab MEX wrapper for object recognition with YOLO (based on pyyolo by thomaspark-pkj).
- git clone --recursive https://github.com/ignacio-rocco/yolomex.git
- Set GPU=1 in Makefile to use GPU and adjust CUDA include path
- make
From Matlab (without CUDA):
mex -I"./darknet/include/" -L"." -lyolo yolomex.c
With CUDA (adjust CUDA lib path):
mex -I"./darknet/src" -I"./darknet/include/" CFLAGS="-Wall -Wfatal-errors -Wno-unused-result -fPIC" -L"." -lyolo -L"/usr/local/cuda-7.0/lib64" -lcudart -lcublas -lcurand yolomex.c
From Matlab:
datacfg = fullfile(pwd,'darknet/cfg/coco.data');
cfgfile = fullfile(pwd,'darknet/cfg/tiny-yolo.cfg');
weightfile = fullfile(pwd,'tiny-yolo.weights');
filename = fullfile(pwd,'darknet/data/person.jpg');
thresh = 0.24;
hier_thresh = 0.5;
I = imread(filename);
yolomex('init',datacfg,cfgfile,weightfile)
detections=yolomex('test',filename,thresh,hier_thresh)
detections=yolomex('detect',I,thresh,hier_thresh)
- Download model into facerec folder using download_model.sh
- From Matlab:
namefile = fullfile(pwd,'facerec/fddb.names');
cfgfile = fullfile(pwd,'facerec/yolo-fddb.cfg');
weightfile = fullfile(pwd,'facerec/yolo-fddb_v2.weights');
filename = fullfile(pwd,'facerec/france.jpg');
thresh = 0.24;
hier_thresh = 0.5;
I = imread(filename);
yolomex('init_name',namefile,cfgfile,weightfile)
detections=yolomex('detect',I,thresh,hier_thresh)