Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Image extension flash quit
-
Hi all,
I'm trying to make a simple pedestrian detection script in numpy and port it to run on my phone. It consists of 2 scipts (hog_pythonista.py and pede_detect_pythonista.py). When using the sample image inside Image like this:
if not appex.is_running_extension(): print('Running in Pythonista app, using test image...') img=Image.open('test:Mandrill') else: img=appex.get_image()
It works OK, but if I go into the photo lib and run as extension, it will fail at the function call into hog_pythonista.py. Any idea what's going wrong?
hog_pythonista.py here: https://github.com/Xunius/HOG_python/blob/master/hog_pythonista.py
pede_detect_pythonista.py here: https://github.com/Xunius/HOG_python/blob/master/pede_detect_pythonista.pyThanks
-
this looks fairly memory and cpu intensive... i suspect this might be too much. Maybe try on a tiny image ?
From App Extensin Programming Guide:
Memory limits for running app extensions are significantly lower than the memory limits imposed on a foreground app. On both platforms, the system may aggressively terminate extensions because users want to return to their main goal in the host app. Some extensions may have lower memory limits than others: For example, widgets must be especially efficient because users are likely to have several widgets open at the same time.
Your app extension doesn’t own the main run loop, so it’s crucial that you follow the established rules for good behavior in main run loops. For example, if your extension blocks the main run loop, it can create a bad user experience in another extension or app.
Keep in mind that the GPU is a shared resource in the system. App extensions do not get top priority for shared resources; for example, a Today widget that runs a graphics-intensive game might give users a bad experience. The system is likely to terminate such an extension because of memory pressure. Functionality that makes heavy use of system resources is appropriate for an app, not an app extension.
-
Thanks for the reply.
You are probably right. If I shrink the image size down to about 150 in both dimension it works, but it becomes too small for the detector to actually work at least for now.
-
Update myself:
I've changed the script to load image from within pythonista rather than running as extension so we don't have the resource limitations, and also re-computed the model parameters. Now the script works, although the model itself is far from accurate.