-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[OV JS] Add optical-character-recognition sample notebook #25191
[OV JS] Add optical-character-recognition sample notebook #25191
Conversation
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.
Hi @qxprakash!
Because it's hard to review notebooks, I split changes by group. In the case when target changes needed I refer to cell and line:
Codestyle remarks
- Two spaces as offset
- Empty line before
return
- Try to do not exeed 80 symbols in line (long urls and paths may be an exception)
- Sort imports: system libs (fs, path, ...), ex packages (canvas, openvino-node, ...), project files (helpers.js, ...)
- One empty line at the end of code block
- No more than two empty lines in the row
- Remove extra comments from code blocks, check that useful comments start from capital letter
- Make an order in variable names (recModel, recCompiled, recogInputLayer, etc). Name should answer what's inside. Do not hesitate using long names. In your case there are two models. Avoid common names like
compiledModel
to do not mix them. - Remove any extra commented code
- Remove extra blocks
Common
- Specify device as 'AUTO' (will be fixed in the rest of notebooks as well)
- Each word in subheaders should start from capital letter (ex: Prepare Image for inference = Prepare Image for Inference)
- I propose to fix input image colors (that shows in notebook). Now it shows with replaced channels.
- Also, propose to keep original comments from Python notebook in the same places
- Use async version of functions like
inferAsync
instead ofinfer
, etc
Targeted remarks
- Prepare Image for inference block, line 18:
There is no need to wrap it as Int32Array
const tensor = new ov.Tensor(ov.element.f32, inputLayer.shape, tensorData);
- Define Post-Processing functions block, line 22
Extract function that uses inmap
- Define Post-Processing functions block, line 31
Why let not const?
Please, use this link to download text recognition model: https://storage.openvinotoolkit.org/repositories/open_model_zoo/public/text-recognition-resnet-fc/ |
@vishniakov-nikolai thanks for your feedback I have tried to address all the points which you have mentioned above I still feel , I might need some more changes in some areas like , code style and comments overall here are the brief summary of fixes Targeted remarks -- All fixed Common -- All fixed except 4th point (Also, propose to keep original comments from Python notebook in the same places) doubt on 4th point -- by original comments you mean the code comments or MarkDown text blocks ? Codestyle remarks
Also I have added the text recoginition model download code please provide your feedback as to where I need more polishing in the codebase |
@qxprakash thank you. Now it works without any addition. Codestyle remarks
Code remarks
General
|
@vishniakov-nikolai thankyou for your feedback ! I have tried addressing all the issues only description is remaining I will add that soon Codestyle Remarks
Code remarks
General
@vishniakov-nikolai let me know if any other changes are required with regards |
Hi @vishniakov-nikolai thanks for your feedback , I have made the changes suggested by you
please let me know if any other changes are needed with regards |
@vishniakov-nikolai I have fixed the remaning code formatting issues , went through the entire sample again to verify the offset , let me know if any other changes are required. |
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.
LGTM
build_jenkins |
Details:
Workarounds which still needs to be worked upon
couldn't find the js equivalent method for
cv2.getTextSize()
(opencv python method) which is used for getting the height and width of the crop text the opencv-wasm package does not have this api , in the current implementation I have written a custom functiongetTextSize
which uses canvas to get the width and height of the texttext-recognition-resnet-fc
model IR was larger in size it was around 355MB hence I did not included it in my PRPlease provide Feedback @Aliczi @vishniakov-nikolai
With Regards
Prakash