Skip to content
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

Feature/add rosetta model support #340

Merged
merged 7 commits into from
Dec 1, 2021
Merged

Conversation

Edjchg
Copy link
Contributor

@Edjchg Edjchg commented Nov 22, 2021

Add the support for Rosetta model for character recognition.

Copy link

@lleon95 lleon95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ext/r2inference/gstrosetta.c Show resolved Hide resolved
ext/r2inference/gstrosetta.c Outdated Show resolved Hide resolved
ext/r2inference/gstrosetta.c Outdated Show resolved Hide resolved
ext/r2inference/gstrosetta.c Outdated Show resolved Hide resolved
ext/r2inference/gstrosetta.c Outdated Show resolved Hide resolved
ext/r2inference/gstrosetta.c Show resolved Hide resolved
ext/r2inference/gstrosetta.c Outdated Show resolved Hide resolved
@@ -61,6 +61,18 @@ gboolean gst_subtract_mean(GstVideoFrame * inframe, GstVideoFrame * outframe, gd

gboolean gst_pixel_to_float(GstVideoFrame * inframe, GstVideoFrame * outframe, gint model_channels);

/**
* \brief Normalize the image to match the Rosetta input tensor requirements.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, do not introduce Rosetta into generic modules. Let's keep it as:

"Normalize grayscale image the image within a given mean and offset"

gst-libs/gst/r2inference/gstinferencepreprocess.c Outdated Show resolved Hide resolved
gst-libs/gst/r2inference/gstinferencepreprocess.c Outdated Show resolved Hide resolved
#include "config.h"
#endif

#include "stdio.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sort the includes appropriately. Check the includes order here: https://google.github.io/styleguide/cppguide.html#Names_and_Order_of_Includes

ext/r2inference/gstrosetta.c Outdated Show resolved Hide resolved
ext/r2inference/gstrosetta.c Show resolved Hide resolved
ext/r2inference/gstrosetta.c Outdated Show resolved Hide resolved
ext/r2inference/gstrosetta.c Outdated Show resolved Hide resolved
'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
};
char *final_phrase =
(char *) malloc (sizeof (char) * (MODEL_OUTPUT_ROWS) + 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer glib functions for memory allocation too (i.e g_malloc0, g_free, etc)


free (output);
return TRUE;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this line

ext/r2inference/gstrosetta.c Show resolved Hide resolved
gst_apply_gray_normalization (GstVideoFrame * inframe, GstVideoFrame * outframe,
gdouble mean, gdouble offset)
{
gint i, j, pixel_stride, width, height;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initialize these variables.

Comment on lines 195 to 197
// Checking if the actual max index value is different from '_' character
// and also, checking if i is greater than 0, and finally, checking
//if the actual max index is equal from the previous one.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a comment style only. GStreamer uses ANSI-C /* */

"Rosetta", "Filter",
"Infers characters from an incoming image",
"Edgar Chaves <edgar.chaves@ridgerun.com>\n\t\t\t"
" Luis Leon <luis.leon@ridgerun.com>\n\t\t\t");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the last \n\t\t\t and the spaces at the beginning

@Edjchg Edjchg force-pushed the feature/add-rosetta-model-support branch from 836af22 to 8125d08 Compare December 1, 2021 00:17
@Edjchg Edjchg merged commit b41bc9b into dev-1.1 Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants