Forum: support


RE: nops_scan() hanging on "rotating PNG, rotating PNG, rotating PNG, ....." [ Reply ] By: Achim Zeileis on 2024-11-07 23:05 | [forum:50001] |
Great, thanks for the follow-up. Glad it helped. |
RE: nops_scan() hanging on "rotating PNG, rotating PNG, rotating PNG, ....." [ Reply ] By: Matthew Haffner on 2024-11-07 20:34 | [forum:50000] |
Just a quick update on this. I administered another exam to 78 students. I used nops_scan() from the CRAN version of the package, and it was again hanging on "rotating PNG...." on the 54th exam sheet. I installed the development version from R Forge as you suggested and everything worked perfectly! Thanks again for your help. |
RE: nops_scan() hanging on "rotating PNG, rotating PNG, rotating PNG, ....." [ Reply ] By: Achim Zeileis on 2024-10-20 09:24 | [forum:49988] |
Oh, and I forgot to say: Thank you for offering to buy me coffee. That's very much appreciated! But my university provides me with both coffee and a good salary. So a simple "thanks" is enough :-) |
RE: nops_scan() hanging on "rotating PNG, rotating PNG, rotating PNG, ....." [ Reply ] By: Achim Zeileis on 2024-10-18 02:23 | [forum:49986] |
Matthew, thanks for the follow-up and the inkscape explanation. I agree that this explains the low default resolution of the PNG I tried previously. Regarding your new comments: - There is no need to rotate the PDF yourself, nops_scan(..., rotate = TRUE) does this for you. - Please try re-running your example after installing the devel version of the exams package. It's sufficiently stable - and you can easily re-install the CRAN version afterwards. install.packages("exams", repos = "https://R-Forge.R-project.org") - If we're lucky, then the devel version is already sufficiently improved that the problems are resolved. - If not, please send me the problematic scans. Either the original PDF (without pdfjam rotation) to my e-mail address. I will treat this confidentially and delete it afterwards. Or alternatively unzip the nops_scan_*.zip file, open the PNG file in an editor (e.g., Gimp), remove the student names and re-save it (in the same resolution). |
RE: nops_scan() hanging on "rotating PNG, rotating PNG, rotating PNG, ....." [ Reply ] By: Matthew Haffner on 2024-10-16 16:06 | [forum:49985]![]() |
Sorry I'm just now responding here. I had two students take the exam late and that has fortuitously provided a useful test case to troubleshoot this further. I admittedly haven't installed the devel version because I suspect there is something wrong on my end, and I'd prefer to nail that down if possible to prevent potential future issues. Of course, I'll go to the devel version in the future if I can't resolve these. I think part of the reason why the resolution was low was due to my export from Inkscape after hiding the student's name on that initial example (96 DPI by default, I think?). On the two files I evaluated just now, I scanned them in black and white at 300 DPI. I then use pdfjam to rotate them 180 degrees, which preserves the resolution (I think it does, at least -- the file size is the same). Running nops_scan() I get this: Loading required namespace: png Loading required namespace: qpdf Loading required namespace: magick Splitting PDF files, done. S0000001.pdf: Converting PDF to PNG. S0000002.pdf: Converting PDF to PNG. Reading PNG files: S0000001.PNG: Trimming PNG, rotating PNG, extracting information, ERROR S0000002.PNG: Trimming PNG, rotating PNG, extracting information, done. Creating ZIP file: adding: Daten.txt (deflated 67%) adding: S0000001.PNG (deflated 0%) adding: S0000002.PNG (deflated 0%) Warning messages: 1: In FUN(X[[i]], ...) : NAs introduced by coercion 2: In nops_scan("../results/exam-01b-pdfjam.pdf", dir = "./scan/") : errors in scanned data, please run nops_fix() on the 'nops_scan_*.zip' file prior to nops_eval() So the infinite loop issue is not present. But when I run nops_fix() on the problematic file, it's clear that none of the exam content has been processed. I first get the attached image, which does indeed look very low resolution. Any ideas? One other issue -- I can't find a link on the r/exams website where I can buy you a coffee. |
RE: nops_scan() hanging on "rotating PNG, rotating PNG, rotating PNG, ....." [ Reply ] By: Achim Zeileis on 2024-10-12 10:19 | [forum:49983] |
Thanks, this is very helpful. First, I couldn't replicate the hanging loop. Neither with the CRAN release version (2.4-1) nor with the development version here on R-Forge (2.4-2). I also tried the older 2.4-0 version. All of these scanned the PNG file albeit with boxes read incorrectly. For example with 2.4-1: nops_scan("S0000018.png", file = FALSE) Loading required namespace: png Reading PNG files: S0000018.png: Trimming PNG, rotating PNG, extracting information, done. [1] "S0000018.png XXXXXXXXXXX 00 045 0 1646002 00000 01000 00001 00100 10011 00001 00001 00001 00001 10000 01010 00100 10000 01000 10000 00001 00100 01000 00010 01000 00100 00010 11000 01000 00010 10011 00100 00001 00100 00010 01000 00000 10000 00100 01000 00001 00001 01010 10000 01000 00001 01000 01000 01000 00011" There are two reasons for the problems that I experienced: First, the resolution of the PNG is relatively low, only 816 x 1056 pixels. Second, the top and bottom margins are much smaller than in the original A4 paper PDF that you printed out. For the second problem I've added an additional check so that this should work more reliably when you're using the devel version from R-Forge. When the exams package is "Current" again at revision 2693 on https://R-Forge.R-project.org/R/?group_id=1337 you can install it via: install.packages("exams", repos="https://R-Forge.R-project.org") For the first problem I recommend to re-scan the files with a higher resolution. This will make it easier for nops_scan() to distinguish between artefacts from the rotation and actual boxes and check marks etc. If problems persist, please follow up. Then we can try to improve results further. |
RE: nops_scan() hanging on "rotating PNG, rotating PNG, rotating PNG, ....." [ Reply ] By: Matthew Haffner on 2024-10-11 20:02 | [forum:49982]![]() |
Here is one of the offending PNG files (edited for confidentiality). I can send more if necessary. Yes, I used nops_fix() and was able to fix up the offending records. It really didn't take much time at all, so that was convenient. I should not that it seems like none of the exam information was registered for those students though. I had to enter the Type, Exam ID, Registration number, and answers for all questions for those students. Thanks for taking a look! |
RE: nops_scan() hanging on "rotating PNG, rotating PNG, rotating PNG, ....." [ Reply ] By: Achim Zeileis on 2024-10-11 00:11 | [forum:49981] |
Can you share one of the offending PNG files with me, e.g., S0000022.PNG? You can either send it to me via e-mail (Achim.Zeileis@R-project.org) and I will treat it confidentially or you can cut the name and signature from the PNG and post it here. Then I will take a look what exactly is going on and can likely provide a solution. The rotation is done in a while loop and apparently the stopping condition never triggers. I'm not sure why. P.S.: Not related to your question at all - but something I point all exams2nops users to. Have you seen the nops_fix() function in the latest release of the package? This facilitates fixing problems after nops_scan, e.g., when some sheets could not be read or only partially. |
nops_scan() hanging on "rotating PNG, rotating PNG, rotating PNG, ....." [ Reply ] By: Matthew Haffner on 2024-10-10 21:27 | [forum:49980] |
I've been using the R exams package with relative success over the past couple of years, but I'm not sure what's going on here. I have an exam that I administered to 38 students, and when running the nops_scan function on the scanned answer sheets, most seem to do just fine, but a few hang on the trimming/rotating PNG step. Here is some abbreviated console output: ... S0000016.PNG: Trimming PNG, rotating PNG, extracting information, done. S0000017.PNG: Trimming PNG, extracting information, done. S0000018.PNG: Trimming PNG, extracting information, done. S0000019.PNG: Trimming PNG, extracting information, done. S0000020.PNG: Trimming PNG, rotating PNG, extracting information, done. S0000021.PNG: Trimming PNG, rotating PNG, extracting information, ERROR S0000022.PNG: Trimming PNG, rotating PNG, rotating PNG, rotating PNG, rotating PNG, rotating PNG, rotating PNG, rotating PNG, rotating PNG.... There are hundreds of those "rotating PNG" outputs for the last entry (S000022.PNG) above. It will complete eventually though (albeit with errors). Interestingly enough, I can't see any discernible issues with the scanned answer sheets in the problematic those positions themselves. There are 4 of 38 answer sheets that produced errors. I've tried rescanning everything and also only scanning a few answer sheets at a time, but no luck. Any idea what may be causing this? Also, is there anything else I can provide to help in troubleshooting? Interestingly enough, I administered an exam to 80 students the day before and everything worked just fine. |