ines
(Ines Montani)
August 30, 2019, 2:39pm
2
Hi! The problem here is that you're only providing a relative path to the image (relative to your Python script). Even if you used the absolute path of the image on your machine, modern browser typically block local file paths for images etc. for security reasons.
See my post here for more details on how to solve this:
Your format is correct, but I think the problem is this: By default, modern browsers will block images and other resources from local file paths for security reasons. So if you open the developer tools, you probably see something like “blocked local resource”. See this thread for more details:
javascript - Cannot open local file - Chrome: Not allowed to load local resource - Stack Overflow
To work around this, you could either serve the files locally on a different port, upload them so an S3 bucket or something similar, or use Prodigy’s fetch_images
helper that takes a stream of image tasks and converts all file paths (local and URLs!) to base64-encoded data URIs.
from prodigy.components.preprocess import fetch_images
stream = fetch_images(stream)
Just keep in mind that this will add the image data to the annotation tasks and store it all in the database. So if you’re working with lots of really large images, your database can potentially get quite large, too.