LabelMeAnnotationTool icon indicating copy to clipboard operation
LabelMeAnnotationTool copied to clipboard

Can't return outside a subroutine at ./LabelMe/annotationTools/perl/fetch_image.cgi

Open srvanderplas opened this issue 6 years ago • 10 comments

Ubuntu 16.04 LTS. Install went ok, all apache mods required have been enabled. Image appears on page load, but then the page returns an error: Fatal: there are problems with fetch_image.cgi

Apache logs show the following:

[Thu Jun 07 13:07:41.886343 2018] [cgi:error] [pid 1427] [client 127.0.0.1:44032] AH01215: [Thu Jun 7 13:07:41 2018] fetch_image.cgi: Can't return outside a subroutine at LabelMe/annotationTools/perl/fetch_image.cgi line 49.: LabelMe/annotationTools/perl/fetch_image.cgi, referer: https://localhost/LabelMe/tool.html?collection=Shoes&mode=i&folder=Shoes&image=image.jpg

I've installed libcgi-session-perl and restarted Apache, but that didn't do much of anything.

Any other suggestions?

srvanderplas avatar Jun 07 '18 18:06 srvanderplas

Try the dockerfile

Abhijit-2592 avatar Jun 08 '18 02:06 Abhijit-2592

Same Issue: image

srvanderplas avatar Jun 08 '18 14:06 srvanderplas

That's weird could be some permission issues. Kindly try this dockerfile from my repo.

Just a caution. Use your username in the dockerfile, since I am mapping it to volumes outside docker we will loose the default example images given with this repo( will raise error with fetch image cgi), manually add the example folder and the corresponding dirlist to the respective folders.

Abhijit-2592 avatar Jun 08 '18 17:06 Abhijit-2592

I did finally get a different docker container to work (I had used the one from your github repo initially before realizing there was a container in the LabelMeAnnotationTool repo). I believe the issue may be at least in part caused by relative path issues - when putting files in ./Images/ and generating a collection, the path used for the links is ../../Images. When this is changed to ../Images instead (in the URL), the image suddenly appears and the perl errors go away. I solved the issue in the docker container that I got working by copying the images from /var/www/html/LabelMeAnnotationTool/Images/ to /var/www/html/Images. With the images in both places, the app works.

I think initially when I was trying to make this work without docker, there were two issues - one is that the polygon tool never actually displayed anything (so likely an issue with SVG) and the other was the same path issue I encountered in docker.

I'm still not sure how to fix the issue with the polygon tool, but at least I have it working now.

On Fri, Jun 8, 2018 at 12:18 PM, Abhijit Balaji [email protected] wrote:

That's weird. Could you give more info on your error?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/CSAILVision/LabelMeAnnotationTool/issues/87#issuecomment-395828190, or mute the thread https://github.com/notifications/unsubscribe-auth/ACB1FSqlaRq6dPU-nMWGCTXypYXX80Dgks5t6rHdgaJpZM4Ue4Hv .

srvanderplas avatar Jun 08 '18 17:06 srvanderplas

Ok the problem why it raises this error when using the dockerfile from my repo is because all the example images are lost while mapping the volumes. Just manually add the example_images folder and it's dirlist in their corresponding folders and it will work. I recommend using the dockerfile from my repo instead of the one in this repo is because,

  1. the dockerfile in this repo will have root access which is obviously not desirable
  2. if you remove the container you will loose your labeled data with it because obviously it is not mounted.

I have given a pull request to correct both of them, but unfortunately they are yet to merge it. So I recommend using the file from my repo, use the sh scripts so that you can set-up without much effort. Let me know of any problems there.

Abhijit-2592 avatar Jun 08 '18 17:06 Abhijit-2592

TL; DR contribution: I also encountered this bug while using a docker, however I have found this occurs when the collection txt list has the same name of the subdirectory containing the images of that collection.

The directory containing the collection subdirectories is correctly mounted at /var/www/html/LabelMeAnnotationTool/Images/. In order to create the collection list for images located at /var/www/html/LabelMeAnnotationTool/Images/foo i would normally run this command: cd /var/www/html/LabelMeAnnotationTool/annotationTools/sh && ./populate_dirlist.sh foo.txt foo This runs succesfully and creates /var/www/html/LabelMeAnnotationTool/annotationCache/DirLists/foo.txt However when attempting to access that collection via the url http://localhost:8080/LabelMeAnnotationTool/tool.html?collection=foo&mode=i i get the error in question. For me it worked by renaming the collection with the different name than the subdirectory named foo, i.e. cd /var/www/html/LabelMeAnnotationTool/annotationTools/sh && ./populate_dirlist.sh bar.txt foo This way /var/www/html/LabelMeAnnotationTool/annotationCache/DirLists/bar.txt is created and the collection can be accessed using the url

deuscovrigus avatar Sep 05 '19 16:09 deuscovrigus

@srvanderplas I think you are affected by what I describe in my previous comment given that your URL https://localhost/LabelMe/tool.html?collection=Shoes&mode=i&folder=Shoes&image=image.jpg is trying to load the collection Shoes found in the Images subfolder also named Shoes. That is you have a /var/www/html/LabelMeAnnotationTool/annotationCache/DirLists/Shoes.txt which points to the images located in var/www/html/LabelMeAnnotationTool/Images/Shoes I would just recreate the collection using a different name using cd /var/www/html/LabelMeAnnotationTool/annotationTools/sh && ./populate_dirlist.sh fancyShoes.txt Shoes

deuscovrigus avatar Sep 05 '19 16:09 deuscovrigus

To continue the story that I started, I have also found out that when running the populate_dirlist.sh script and giving the name of the list with non-lower case letters, the collection will be retrieved incorrectly in the URL . That is ./populate_dirlist.sh fancyShoes.txt Shoes will correctly create the txt file in annotationCache/DirLists however the image cgi error will occur when attempting to display this collection via the URL. The lower case only name works, i.e. ./populate_dirlist.sh fancyshoes.txt Shoes I am currently on commit commit ac68b5b333b89b2fcb03d4fc9aedcfa8fc046b7e

deuscovrigus avatar Sep 05 '19 17:09 deuscovrigus

Ubuntu 16.04 LTS. Install went ok, all apache mods required have been enabled. Image appears on page load, but then the page returns an error: Fatal: there are problems with fetch_image.cgi

Apache logs show the following:

[Thu Jun 07 13:07:41.886343 2018] [cgi:error] [pid 1427] [client 127.0.0.1:44032] AH01215: [Thu Jun 7 13:07:41 2018] fetch_image.cgi: Can't return outside a subroutine at LabelMe/annotationTools/perl/fetch_image.cgi line 49.: LabelMe/annotationTools/perl/fetch_image.cgi, referer: https://localhost/LabelMe/tool.html?collection=Shoes&mode=i&folder=Shoes&image=image.jpg

I've installed libcgi-session-perl and restarted Apache, but that didn't do much of anything.

Any other suggestions?

Ubuntu 18.04 In LabelMeAnnotationTool/annotationTools/perl copy globalvariables.pl to /etc/perl

znstj avatar Jun 10 '21 05:06 znstj

oops. i had the same message and posted https://github.com/CSAILVision/LabelMeAnnotationTool/issues/110

The good news is that the error has nothing to do with docker. It is wrong perl code.

nkrot avatar Jul 14 '21 18:07 nkrot