-
Notifications
You must be signed in to change notification settings - Fork 211
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
Crashing with big images in demo #1122
Comments
Can you please upload the image somewhere so that I can test it out locally? |
I tried this on my phone. The image takes WAY to long to load. So long that it can be considered as a crash. The browser insists on stopping the script. Trying it on my PC now. |
Same with me. |
Perhaps we can pursue #922 which would give people option to resize as the first step? #922 also suggests consolidating the 'resize' that's used in the preview generator, so it resizes once, then passes the small image to each preview generator, instead of resizing in each generator, this will likely make a BIG difference. Shall we try this next? |
I tried it on a huge 4K image. It didn't crash as such but the browser insisted on stopping the script several times but only at the start(because of previews perhaps). After loading, it works fine but still takes some time to process. |
That preview proposal is extremely important I feel. On phones for e.g., previews make IS unusable. |
Agreed, all! 🙌 |
Hey, just yea i do have this in my proposal and would pursue this one after opencv. |
Sure, cool with that!!
…On Sat, Jun 22, 2019 at 1:55 AM aashna27 ***@***.***> wrote:
Hey, just yea i do have this in my proposal and would pursue this one
after opencv.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1122?email_source=notifications&email_token=AHOHJL7BGIPFXRWVZFDXG53P3U2LRA5CNFSM4H2THKLKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYJQBEA#issuecomment-504561808>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHOHJLZ2TXTRBSYOSZ7JKULP3U2LRANCNFSM4H2THKLA>
.
|
Some general comments: -This is a really important topic since many users will want to process high resolution data. My general view is that IS needs to work with images at least 10MB / (3280x2464). This would match the Raspberry PI image formats as well as other camera formats. -I have noticed that the ''page unresponsive" notice that may occur on loading large file sizes (~3MB) generally occurs at the initial 'Select or drag in an image to start/Choose file/Take a Photo' prompt box. So, if you were to load a small file first (or keep the example image) and then use the select a module/import image, it generally works. I assumed this ‘initial load size limit’ has something to do with the ’Take a photo’ or ‘select/drag an image’ options since they seem to be the only difference between different loading options, but, I can’t say for sure. -Another observation is that different sequences may or may not work with large file sizes. For example, a 40 MB file can be loaded within 5 seconds (just not at the ‘Take a photo’ prompt) and can be easily Inverted (within a few seconds) or flipped. If you were to take the same 40MB image and use the contrast module, you will receive ‘page unresponsive/Aw Snap something went wrong’; the 40MB image with ‘detect edges’ results in a never ending spinning circle with no error response. The three different outcomes (works, unresponsive message, spinning circle) seem to be dependent on the level of processing required but, again, I can say for certain. Failures may not just be about total file size, other restrictions such as #of Horizontal vs Vertical pixels may also limit processing. -My download IS record is 110MB! At 110MB, the sequences that work for 40MB (invert and flip) provide unresponsive errors. So you can’t really do much with IS and very very large file sizes but its possible to download 100MB files! (270MB attempt yielded unresponsive message so max limit seems to be between 110 and 270MB). Options for way forward: -1)The most significant problem is that the initial prompt to load an image has inconsistent performance based on file size. This is unfortunate since it’s the first thing that new users may experience. The first place to look is whether the camera/drag an image option interferes with the load process, the other option is to eliminate the opening sequence all together and import images direct from the drop box menu since this seems to be reliable. -Another recommendation is to routinely run/test all modules with larger file sizes and with different dimensions. Additional testing needs to be done to determine if other modules besides ‘Select or drag an image” have unresponsive errors for large file sizes. Users will become frustrated if they can successfully load an image and then be unable to process the image. I have loaded some practice 4.7Mb and 12.5MB files on github that can be used for testing https://github.com/MargaretAN9/GSOC-2019/tree/master/IS%20test%20picture%20large%20size . -The last comment is that it will be interesting to see if OpenCV provides faster processing times. If this is the case, it may be possible to rewrite some IS modules with OpenCV functions. OpenCV also provides compression options that may also help in reducing file size. (Of course, we need to get it working first…). |
Hi all. This is becoming a big problem. Big images don't even load in some browser. In some browsers like Firefox, they slow it down to a point when the browser insists on stopping the script as it the script is considered unresponsive. I am going to conduct a series of experiments like running a profiler, tweaking some code, turning off previews, etc. I will try to narrow down the slow code. Posting the results shortly. |
ReportWith Previews (stock image)
img.onload = function() {
var canvas = document.createElement('canvas')
canvas.width = img.width
canvas.height = img.height
var context = canvas.getContext('2d')
context.drawImage(img, 0, 0)
var pixels = context.getImageData(0, 0, img.width, img.height)
cb(null, ndarray(new Uint8Array(pixels.data), [img.width, img.height, 4], [4, 4*img.width, 1], 0))
} else if (ref.options.inBrowser) {
var ext = src.split('.').pop();
var image = document.createElement('img');
var canvas = document.createElement('canvas');
var context = canvas.getContext('2d');
image.onload = function() {
canvas.width = image.naturalWidth;
canvas.height = image.naturalHeight;
context.drawImage(image, 0, 0);
datauri = canvas.toDataURL(ext);
callback(datauri, step);
};
image.src = src;
} Conclusion: Takes about 5s with stock image (JS function calls take the longest time) |
Without Previews (Stock Image)
Bigger External Image (No Previews)
Above 4K size image (No Previews)
|
Conclusion
|
cc @jywarren @publiclab/is-reviewers @tech4GT @Divy123 @aashna27 @MargaretAN9 |
May I ask what is GC? 🙈 |
We can reduce GC by not setting too many variables or by setting them to null so that there is no memory leak. |
Could we - thinking - could we use one sequencer instance for resizing, and just create new ones to do each preview with the output of the first resizing-sequencer? |
Can we close this now? |
Yes, I think so! Thanks!!! |
I loaded http://beta.sequencer.publiclab.org with a large image and after a few minutes, saw:
Not sure if this is related to #1093 ?
The text was updated successfully, but these errors were encountered: