GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [video] Streaming AutoML Classification by anguillanneuf · Pull Request #2313 · GoogleCloudPlatform/python-docs-samples

Conversation

@anguillanneuf

@anguillanneuf anguillanneuf commented Aug 2, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

I had to hardcode project_name and model_id in the test for this sample. @dizcology @nnegrey Is there a better way to do it? For instance, use environment variables for them?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
anguillanneuf added 2 commits August 2, 2019 11:11
@anguillanneuf
Video Intelligence Beta - Streaming/Live Streaming support for AutoML…
b6c7a5b
… custom models
@anguillanneuf
add test skeleton
9c214db
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Aug 2, 2019
@anguillanneuf anguillanneuf added do not merge Indicates a pull request not ready for merge, due to either quality or timing. and removed cla: yes This human has signed the Contributor License Agreement. labels Aug 2, 2019
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Aug 2, 2019
@anguillanneuf
anguillanneuf requested a review from beccasaurus August 2, 2019 18:17
@anguillanneuf

anguillanneuf commented Aug 2, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

@beccasaurus I just added some skeleton code. Would you kindly comment on function names and region tag names?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

anguillanneuf added 2 commits August 12, 2019 16:00
@anguillanneuf
skeleton
a1ed8e4
@anguillanneuf
more skeleton code
f2a052f
@anguillanneuf
anguillanneuf requested a review from dizcology August 14, 2019 00:48
@anguillanneuf
update sample: update video codec/test/model_id/etc.
ec58563
@anguillanneuf anguillanneuf removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Aug 24, 2019
@anguillanneuf anguillanneuf changed the title Video Intelligence Beta - Streaming/Live Streaming support for AutoML Custom Models [video]: Streaming AutoML Classification Aug 24, 2019
@anguillanneuf anguillanneuf changed the title [video]: Streaming AutoML Classification [video] Streaming AutoML Classification Aug 24, 2019
@anguillanneuf
lint
f1298a1
@anguillanneuf
anguillanneuf requested review from leahecole and nnegrey August 24, 2019 00:11
nnegrey
nnegrey reviewed Aug 26, 2019
View reviewed changes
Comment thread video/cloud-client/analyze/beta_snippets_test.py

@pytest.mark.slow
def test_streaming_automl_classification(capsys, in_file):
model_id = 'VCN6363999689846554624'

@nnegrey nnegrey Aug 26, 2019

Copy link
Copy Markdown
Contributor

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.

@anguillanneuf, responding here, but for modelid I'm not sure if there is a better way.

But for project_id you can typically use:

import os
os.environ['GCLOUD_PROJECT`]

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@anguillanneuf anguillanneuf Aug 26, 2019

Copy link
Copy Markdown
Member Author

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.

Done!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@beccasaurus beccasaurus Aug 26, 2019

Copy link
Copy Markdown
Contributor

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.

This still shows a literal model_id identifier here, I don't see it updated to use an environment variable

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@leahecole leahecole Aug 27, 2019

Copy link
Copy Markdown
Collaborator

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.

Sorry I'm late to the party here but I just noticed that in_file isn't defined in this test - it's defined in test_track_objects_gcs() - should its definition also be added to this function so that we're following the practice of making sure tests can run alone and/or in any order? @anguillanneuf

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@anguillanneuf anguillanneuf Aug 27, 2019

Copy link
Copy Markdown
Member Author

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.

Thanks Leah for catching this! I had meant to use 'video_path' instead of 'in_file' because 'video_path' can be used as a fixture. Addressing it now.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

leahecole reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@anguillanneuf
mask project id
c02d79c
nnegrey
nnegrey reviewed Aug 26, 2019
View reviewed changes
Comment thread video/cloud-client/analyze/beta_snippets.py Outdated
gs://mybucket/myfolder

python beta_snippets.py streaming-automl-classification \
resources/cat.mp4 projects/myproject/location/mylocation/model/mymodel

@nnegrey nnegrey Aug 26, 2019

Copy link
Copy Markdown
Contributor

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.

Nit:

Thoughts on changing:
projects/myproject/location/mylocation/model/mymodel
To:
projects/[PROJECT_ID]/location/[LOCATION]/model/[MODEL_NAME]

Or something like the above to help show which things need to be changed?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@anguillanneuf anguillanneuf Aug 26, 2019

Copy link
Copy Markdown
Member Author

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.

Updated. [LOCATION] needs to be hard coded to us-central1 because it is the only region that supports this feature at the moment.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
nnegrey
nnegrey reviewed Aug 26, 2019
View reviewed changes
Comment thread video/cloud-client/analyze/beta_snippets.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

nnegrey
nnegrey reviewed Aug 26, 2019
View reviewed changes
Comment thread video/cloud-client/analyze/beta_snippets_test.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

nnegrey
nnegrey approved these changes Aug 26, 2019
View reviewed changes

@nnegrey nnegrey left a comment

Copy link
Copy Markdown
Contributor

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

Added a few comments, only thing I think needs fixing or left alone is the License header, rest are just my own opinion, but not required.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
beccasaurus
beccasaurus reviewed Aug 26, 2019
View reviewed changes
Comment thread video/cloud-client/analyze/beta_snippets.py Outdated
from google.cloud.videointelligence_v1p3beta1 import enums

# path = 'path_to_file'
# model_path = 'projects/project_id/locations/location_id/models/model_id'

@beccasaurus beccasaurus Aug 26, 2019

Copy link
Copy Markdown
Contributor

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.

Could we ask for project_id and model_id to be passed in separately?

This is how we traditionally do samples which require a project path :)

Python has helper methods for creating these long model resource paths, e.g.

client.model_path("project id", "us-central1", "model id")

We have pre-existing examples for samples that require project ID (in "resource paths" like this) for: Product Search and Translation (v3 translation has Glossary objects with resource paths)

See Product Search example:
https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/vision/cloud-client/product_search/product_set_management.py#L39

Excerpt:

# [START vision_product_search_create_product_set]
def create_product_set(
        project_id, location, product_set_id, product_set_display_name):
    """Create a product set.
    Args:
        project_id: Id of the project.
        location: A compute region name.
        product_set_id: Id of the product set.
        product_set_display_name: Display name of the product set.
    """
    client = vision.ProductSearchClient()

    # A resource that represents Google Cloud Platform location.
    location_path = client.location_path(
        project=project_id, location=location)

    # Create a product set with the product set specification in the region.
    product_set = vision.types.ProductSet(
            display_name=product_set_display_name)

    # The response is the product set with `name` populated.
    response = client.create_product_set(
        parent=location_path,
        product_set=product_set,
        product_set_id=product_set_id)

    # Display the product set information.
    print('Product set name: {}'.format(response.name))
# [END vision_product_search_create_product_set]

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@anguillanneuf anguillanneuf Aug 26, 2019

Copy link
Copy Markdown
Member Author

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 are missing a method that constructs the model path from the video intelligence client. How about I use string formatting here instead?

['SERVICE_ADDRESS',
 '_INTERFACE_NAME',
 '__class__',
 '__delattr__',
 '__dict__',
 '__dir__',
 '__doc__',
 '__eq__',
 '__format__',
 '__ge__',
 '__getattribute__',
 '__gt__',
 '__hash__',
 '__init__',
 '__init_subclass__',
 '__le__',
 '__lt__',
 '__module__',
 '__ne__',
 '__new__',
 '__reduce__',
 '__reduce_ex__',
 '__repr__',
 '__setattr__',
 '__sizeof__',
 '__str__',
 '__subclasshook__',
 '__weakref__',
 '_client_info',
 '_inner_api_calls',
 '_method_configs',
 'enums',
 'from_service_account_file',
 'from_service_account_json',
 'streaming_annotate_video',
 'transport']

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
beccasaurus
beccasaurus reviewed Aug 26, 2019
View reviewed changes

@beccasaurus beccasaurus left a comment

Copy link
Copy Markdown
Contributor

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.

Almost LGTM

    1. Update the model ID to come from an environment variable (from Noah's comment, code not showing the change)
    1. Have the method accept project_id and model_id parameters and use client.model_path to build the full resource path

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@anguillanneuf
Noah's and Rebecca's suggestions
bae60dc
@anguillanneuf
anguillanneuf requested a review from beccasaurus August 26, 2019 21:00
@anguillanneuf
anguillanneuf merged commit 03840af into master Aug 26, 2019
@anguillanneuf
anguillanneuf deleted the live_stream_automl branch August 26, 2019 21:15
@leahecole

leahecole commented Aug 26, 2019

Copy link
Copy Markdown
Collaborator

🎉

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@anguillanneuf anguillanneuf mentioned this pull request Aug 27, 2019
video: use video_path fixture in test #2363
Merged
busunkim96 pushed a commit to busunkim96/python-videointelligence that referenced this pull request May 20, 2020
@anguillanneuf
[video] Streaming AutoML Classification [(#2313)](GoogleCloudPlatform…
b3c0de0
…/python-docs-samples#2313)

* Video Intelligence Beta - Streaming/Live Streaming support for AutoML custom models

* add test skeleton

* skeleton

* more skeleton code

* update sample: update video codec/test/model_id/etc.

* lint

* mask project id

* Noah's and Rebecca's suggestions
danoscarmike pushed a commit to googleapis/python-videointelligence that referenced this pull request Sep 30, 2020
@anguillanneuf @danoscarmike
[video] Streaming AutoML Classification [(#2313)](GoogleCloudPlatform…
d5488ae
…/python-docs-samples#2313)

* Video Intelligence Beta - Streaming/Live Streaming support for AutoML custom models

* add test skeleton

* skeleton

* more skeleton code

* update sample: update video codec/test/model_id/etc.

* lint

* mask project id

* Noah's and Rebecca's suggestions
dizcology pushed a commit that referenced this pull request Sep 11, 2023
@anguillanneuf @danoscarmike
[video] Streaming AutoML Classification [(#2313)](#2313)
31c4a2c
* Video Intelligence Beta - Streaming/Live Streaming support for AutoML custom models

* add test skeleton

* skeleton

* more skeleton code

* update sample: update video codec/test/model_id/etc.

* lint

* mask project id

* Noah's and Rebecca's suggestions
@dizcology dizcology mentioned this pull request Sep 11, 2023
migrate code from googleapis/python-videointelligence #10605
Merged
9 tasks
leahecole pushed a commit that referenced this pull request Sep 15, 2023
@anguillanneuf @leahecole
[video] Streaming AutoML Classification [(#2313)](#2313)
fa9c6f6
* Video Intelligence Beta - Streaming/Live Streaming support for AutoML custom models

* add test skeleton

* skeleton

* more skeleton code

* update sample: update video codec/test/model_id/etc.

* lint

* mask project id

* Noah's and Rebecca's suggestions
parthea pushed a commit to googleapis/google-cloud-python that referenced this pull request Sep 22, 2023
@anguillanneuf @danoscarmike
[video] Streaming AutoML Classification [(#2313)](GoogleCloudPlatform…
d4efaaa
…/python-docs-samples#2313)

* Video Intelligence Beta - Streaming/Live Streaming support for AutoML custom models

* add test skeleton

* skeleton

* more skeleton code

* update sample: update video codec/test/model_id/etc.

* lint

* mask project id

* Noah's and Rebecca's suggestions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@dizcology dizcology Awaiting requested review from dizcology
@leahecole leahecole Awaiting requested review from leahecole
@beccasaurus beccasaurus Awaiting requested review from beccasaurus
1 more reviewer
@nnegrey nnegrey nnegrey approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@anguillanneuf @leahecole @beccasaurus @nnegrey @googlebot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.