Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
srvanderplas opened this issue Jun 7, 2018 · 10 comments

Comments

@srvanderplas
Copy link

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?

@Abhijit-2592
Copy link
Contributor

Try the dockerfile

@srvanderplas
Copy link
Author

Same Issue:
image

@Abhijit-2592
Copy link
Contributor

Abhijit-2592 commented Jun 8, 2018

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.

@srvanderplas
Copy link
Author

srvanderplas commented Jun 8, 2018 via email

@Abhijit-2592
Copy link
Contributor

Abhijit-2592 commented Jun 8, 2018

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.

@deuscovrigus
Copy link

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
Copy link

deuscovrigus commented Sep 5, 2019

@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
Copy link

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 ac68b5b

@znstj
Copy link

znstj commented Jun 10, 2021

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

@nkrot
Copy link

nkrot commented Jul 14, 2021

oops. i had the same message and posted #110

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants