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

Tfhub object detection improvements #50

Merged
merged 37 commits into from
Jan 5, 2023

Conversation

cfascina
Copy link
Contributor

@cfascina cfascina commented Dec 5, 2022

Improvements at tfhub computer vision models (base64 and URL versions) after reviews.

Risks and Area of Effect

Testing

  • Unit test
  • Deployed to dev env
  • Other (explain)

Reverting

  • Contains Migration - Do Not Revert

@cfascina cfascina requested a review from liuverta December 5, 2022 13:22
@cfascina cfascina self-assigned this Dec 5, 2022
@cfascina cfascina requested a review from liuverta December 14, 2022 13:18
@cfascina cfascina requested a review from liuverta December 23, 2022 13:23
@liuverta liuverta mentioned this pull request Dec 24, 2022
4 tasks
@cfascina cfascina requested a review from liuverta January 2, 2023 17:36
Copy link
Contributor

@liuverta liuverta left a comment

Choose a reason for hiding this comment

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

@cfascina In addition to my feedback above, I have an additional proposal. Let me know what you think:

The client's ModelAPI() current has a requirement (Slack thread)

arguments to ModelAPI() must be lists of data

Could we change these models' predict() to take a list and return a list? Something like

    def predict(self, data):
        result = []
        for image in data:
            file_name, img = image
            result.append(self.detect_objects(file_name, img))

        return result

Then we should be able to correctly match model API to this new format

    model_api = ModelAPI(
        [
            ['file_name', 'img']
        ],
        [{
            'file_name': '',
            'has_car': False,
            'score': 0,
            'bboxes': {
                'ymin': 0,
                'xmin': 0,
                'ymax': 0,
                'xmax': 0
            }
        }]
    ),

@cfascina
Copy link
Contributor Author

cfascina commented Jan 3, 2023

@cfascina In addition to my feedback above, I have an additional proposal. Let me know what you think:

The client's ModelAPI() current has a requirement (Slack thread)

arguments to ModelAPI() must be lists of data

Could we change these models' predict() to take a list and return a list? Something like

    def predict(self, data):
        result = []
        for image in data:
            file_name, img = image
            result.append(self.detect_objects(file_name, img))

        return result

Then we should be able to correctly match model API to this new format

    model_api = ModelAPI(
        [
            ['file_name', 'img']
        ],
        [{
            'file_name': '',
            'has_car': False,
            'score': 0,
            'bboxes': {
                'ymin': 0,
                'xmin': 0,
                'ymax': 0,
                'xmax': 0
            }
        }]
    ),

@liuverta, the way you suggested is clearer to me. I made some changes.
Note that ModelAPI input argument had to be a dict: [{'file_name': '', 'url': ''}], with ['file_name', 'img'] the API shows 0 and 1 for these values.
And a few more adjstuments were necessary too.

@cfascina cfascina requested a review from liuverta January 3, 2023 23:39
@cfascina cfascina requested a review from liuverta January 5, 2023 14:20
Copy link
Contributor

@liuverta liuverta left a comment

Choose a reason for hiding this comment

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

Great! Thank you so much for your work on this

@cfascina cfascina merged commit 77b3116 into main Jan 5, 2023
@liuverta liuverta deleted the tfhub-object-detection-improvements branch January 6, 2023 18:14
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.

2 participants