php-opencv / php-opencv

opencv 4.5+ with dnn module for php 7/8

Home Page:https://github.com/php-opencv/php-opencv-examples

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

memory problem

kimia000 opened this issue · comments

When running classify_image_by_dnn_mobilenet.php from the examples, if using a larger model (than the one provided)

$net = \CV\DNN\readNetFromCaffe('deploy.prototxt', 'caffenet.caffemodel');
the script terminates at

$r = $net->forward();

with the error:

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
Aborted (core dumped)

which I believe is memory-related. How is the memory used by the underlying C++ process is limited, and how to lift this limit?

By default php (not a C++ process) is limited:
memory_limit "128M"
Did you change memory_limit in php.ini?

Hi
i got the same issue , trying to use this in laravel , any solution. memory limit increased to 1GB .
Its working fine when i run it from same folder.