imglab
imglab copied to clipboard
Issues with generated XML file
- Output from your software is floating point values for x,y but
dlib
requires them to be integers. - Encoding of the file does not match
dlib
. You outputUTF-8
and the first line of the XML is buggy (dlib yelled error at the first line of the XML when training). Butdlib
requires encoding ofISO-xxxxx
Please fix this if possible.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
Thanks to report an issue. Can you please confirm which version of imglab are you trying?
https://naturalintelligence.github.io/imglab/
this is v1. We're no longer doing any change on v1. All the bugs will be fixed at v2
https://naturalintelligence.github.io/imglab/v2.html
I most probably will make it live on Monday. And will also fix your bug there.
Is v2 usable now?
On Sat, Jun 30, 2018 at 8:08 PM Amit Gupta [email protected] wrote:
this is v1. We're no longer doing any change on v1. All the bugs will be fixed at v2
https://naturalintelligence.github.io/imglab/v2.html
I most probably will make it live on Monday. And will also fix your bug there.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/NaturalIntelligence/imglab/issues/56#issuecomment-401540208, or mute the thread https://github.com/notifications/unsubscribe-auth/AOgsdFHsDZbA2MHo2lPsPUIyiPIQFccAks5uB3g0gaJpZM4U9816 .
-- Best regards, Chanchana
It has most of the features supported by v1. However some necessary features are expected to be completed by Monday.
Have a look and tell us if you miss something there.
@off99555 point 1 is fixed in v2. I need more detail for point 2. As I can see the correct result.
Please try v2 only.
You could try training in dlib train_shape_predictor and you would see the error. The text doesn't look suspicious but the BOM utf8 encoding is. From looking at the file using the eyes, there is no issue, but it didn't work in dlib. So you should try with dlib trainer first.
I've fixed the changes as per your suggestion. Please test it and let me know.
v2 link is down
I've make the v2 live now. So you need not to append v2.html in last.
@off99555 I'm expecting that your problem must have been resolved. If not, please reopen the issue or raise new one for other issues.
(I was going to file this as a new bug, but instead, this bug should be reopened.)
Better Bug Description
Output for box should be converted to integers (floor, ceil, round) as appropriate for dlib
. The library dlib apparently does not like non-integral coordinates. I got this error msg when running their example code with the XML output file generated by imglab:
./dnn_mmod_train_find_cars_ex ~/Pictures/sc/
Error on line 96: string cast error: invalid string = '35.71428571428571'
This makes sense, in that dlib looks at entire pixels, not fractional ones. (Although, I suppose one could argue that dlib should be more robust.)
My XML file that I created has this line in it:
<box top='35.71428571428571' left='62.85714285714285' width='509.99999999999994' height='1257.1428571428569'>
To Reproduce Steps to reproduce the behavior:
- Load a picture
- zoom in (I think this is what creates fractional pixel coordinates).
- mark a bounding box with a rectangle
- export data to dlib training.xml
- try running the dnn_mmod_train_find_cars_ex with the directory containing the XML file and images.
Screenshots
Console Errors N/A because the XML errors that are created affect dlib processing, well after imglab is finished.
**Device detail
- Mac OS 10.14.4 (18E226)
- Version 74.0.3729.169 (Official Build) (64-bit)
- For imglab,
git log
commit 62eaeba4e41bc6f84e1113b8dc75053bbd692e18
Author: Amit Gupta <[email protected]>
Date: Thu Nov 29 13:32:43 2018 +0530
For dlib
git log
commit dbe569a1f1808756016b50310dc273ce8848e0b3
Author: Adrià Arrufat <[email protected]>
Date: Mon May 6 01:07:51 2019 +0900
Additional context
I believe the problem is in file imglab/dataformaters/dlib.js
line 34:
imgXMLStr += "\t\t<box top='"+box.y+"' left='"+box.x+"' width='"+box.w+"' height='"+box.h+"'>\n";
which does not do any rounding. The fix should be:
imgXMLStr += "\t\t<box top='"+Math.floor(box.y)+"' left='"+Math.floor(box.x)+"' width='"+Math.ceil(box.w)+"' height='"+Math.ceil(box.h)+"'>\n";
(I'm assuming it's better to expand the box outwards)
Notice in the code, that the part coordinates are rounded down (with Math.floor
). I think it's better to use Math.round
instead.
for(var shape_i in shapes){
var box = shapes [ shape_i ].bbox;
imgXMLStr += "\t\t<box top='"+box.y+"' left='"+box.x+"' width='"+box.w+"' height='"+box.h+"'>\n";
imgXMLStr += "\t\t\t<label>"+ shapes [ shape_i ].label +"</label>\n";
//Add points
var fPoints = shapes [ shape_i ].featurePoints;
for(var fPoint_i in fPoints){
var label = fPoints[ fPoint_i ].label;
console.log(label);
var fPoint = fPoints [ fPoint_i ];
//TODO: pad fPoint_i
imgXMLStr += "\t\t\t<part name='"+ fPoint_i +"' x='"+ Math.floor(fPoint.x)+"' y='"+ Math.floor(fPoint.y) +"'/>\n";
}
Thanks for reporting. Though, reopning. It's better to create new issue.
Rats... in another github project, they wanted me not to create a new issue.... but rather reopen an old one.
Any live link to V2?
v2 is live. v1 has been removed. So no separate link for v2
May I know if the current link is https://imglab.in/ ?
I tried but still got floating point in the dlib xml. Any ideas?
May I know if the current link is https://imglab.in/ ?
I tried but still got floating point in the dlib xml. Any ideas?
See my comment above from May 24. A Math.round is(was) missing.
@gitclem implemented your changes @blueclowd please check if your issue is fixed.