-
Notifications
You must be signed in to change notification settings - Fork 19
Improve RecogniseGeneric and document RecogNode #308
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
Improve RecogniseGeneric and document RecogNode #308
Conversation
55c6f1d to
d2f34bf
Compare
Codecov Report
@@ Coverage Diff @@
## master #308 +/- ##
==========================================
- Coverage 78.61% 78.60% -0.02%
==========================================
Files 43 43
Lines 18433 18454 +21
==========================================
+ Hits 14492 14506 +14
- Misses 3941 3948 +7
|
|
The lines which are not covered are mostly lines where recognition failed and I improved warning messages. I wouln't add extra tests for that since I'm a bit short on time. IMO we can ignore this. |
|
@FriedrichRober Since you also looked at the last PR concerning the docs of IsReady. Could you have a look at the updated documentation of IsReady again and tell me whether you think that's again an improvement? |
|
Yes, I will have a look today. |
d2f34bf to
19ef011
Compare
FriedrichRober
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only have some minor comments. The reworked documentation for IsReady is fine.
| if not IsReady(rifac) then | ||
| # the recognition of the image failed, also give up here: | ||
| # IsReady is not set, thus abort the whole computation. | ||
| if InfoLevel(InfoRecog) = 1 and depth = 0 then Print("\n"); fi; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we print here some information that the computation is aborted?
| if InfoLevel(InfoRecog) = 1 and depth = 0 then Print("\n"); fi; | |
| if InfoLevel(InfoRecog) = 1 and depth = 0 then Print("\n"); fi; | |
| Info(InfoRecog, 1, | |
| "ImageRecogNode of node <ri> could not be recognised,", | |
| " IsReady(<ri>) is not set!"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I'll add such an info message to the "unfinished case". And now that I think about it, we don't need to print anything in the "image" or "kernel" parts of RecogniseGeneric, since the warning message is printed in the "unfinished case" part already.
Nvm, I was thinking about the mandarins. I'll update both warning messages.
| SetParentRecogNode(riker,ri); | ||
| Info(InfoRecog,2,"Back from kernel (depth=",depth,")."); | ||
|
|
||
| if not IsReady(riker) then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here the same, maybe we should print something here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to print something here, since we're only "exiting". The warning message was already printed in one of the "failed cases" that is in the "unfinished case" part or in the "recognise the image" part.
19ef011 to
96ca419
Compare
- Clean up of comments. - Some refactoring. - Improve the warning message if recognition of a node does not terminate. Since IsReady is not set, an error will be thrown once one wants do something with the recognition data structure. Thus it is not necessary to throw an error in RecogniseGeneric. Make sure that, if everything went fine, then IsReady is set directly before returning.
96ca419 to
d6b1fcf
Compare
|
@FriedrichRober I think I have again made the docs of IsReady a bit more precise. Could you have another quick look? ^^ |
|
Ah no, wait a second. I was in Mandarin-land again. |
|
Ok, now the docs of IsReady should be good to go. The version before the |
|
The doc of IsReady sounds now a bit more technical, but I understand what is going on. I approve. |
gap/base/recognition.gi
Outdated
| end ); | ||
|
|
||
| InstallOtherMethod( RecogNode, | ||
| "for backwards compatibility", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are you trying to be backwards compatible with, though? is there still code in the repo that calls it like that? If so, can't we just update that code?
Other than that: any external code won't be calling RecogNode, as it didn't exist before, right? It'll call EmptyRecognitionInfoRecord, so that code needs to be adjusted anyway. Or perhaps we can retain EmptyRecognitionInfoRecord in a new file gap/obsolete.gi; but then that backwards compatible function can take of reordering the arguments.
Perhaps I am missing something, though?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps I am missing something, though?
Nope, that makes perfect sense, thanks! 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going with this:
Or perhaps we can retain EmptyRecognitionInfoRecord in a new file gap/obsolete.gi; but then that backwards compatible function can take of reordering the arguments.
fingolfin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me (but note my comment on the backwards compatibility method)
dc93ddd to
5c08ab7
Compare
|
I had to fiddle around a bit with the backwards compatibility method, but now it works on my machine. I'll wait for tests to pass, then this gets merged. Nope, there is an unbound global variable somewhere. |
7f4b653 to
c0d88de
Compare
Also rename the corresponding type. Rename as follows: RecognitionInfoType -> RecogNodeType EmptyRecognitionInfoRecord -> RecogNode
c0d88de to
cf86f68
Compare
terminate. Since IsReady is not set, an error will be thrown once one
wants do something with the recognition data structure. Thus it is not
necessary to throw an error in RecogniseGeneric. Make
sure that, if everything went fine, then IsReady is set directly
before returning.
Rename as follows:
RecognitionInfoType -> RecogNodeType
EmptyRecognitionInfoRecord -> RecogNode