RetinaNet model tries to write to system directory
rhysperry111 opened this issue · 0 comments
rhysperry111 commented
When trying to use ObjectDetection on an image with RetinaNet I get the following error:
Traceback (most recent call last):
File "/home/rhys/src/imagerec/detector.py", line 19, in <module>
detection = detector.detectObjectsFromImage(input_image=image)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/imageai/Detection/__init__.py", line 387, in detectObjectsFromImage
fnames, original_imgs, scaled_images = self.__load_image_retinanet(input_image)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/imageai/Detection/__init__.py", line 150, in __load_image_retinanet
input_image = self.__save_temp_img(input_image=input_image)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/imageai/Detection/__init__.py", line 131, in __save_temp_img
input_image.save(temp_path)
File "/usr/lib/python3.11/site-packages/PIL/Image.py", line 2436, in save
fp = builtins.open(filename, "w+b")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/usr/lib/python3.11/site-packages/imageai/Detection/e28e5dc8-a4cd-4238-bd9b-95a60ab9c46f.jpg'
It seems to be trying to write to the system directory with which imageai is installed. I can fix the error by running as root, however this is obviously not the correct way to solve the problem, and it also ends up cluttering the system directory.