Skip to content

Commit

Permalink
video: adding GA samples for logo detection [(#3098)](GoogleCloudPlat…
Browse files Browse the repository at this point in the history
…form/python-docs-samples#3098)

* DO NOT MERGE. vision: adding GA samples for logo detection

* fixing linter issues across several sample files

* responding to Noah's comments

* responding to comments - fixing whitespace and file references

* Addressing comments

* Update video/cloud-client/analyze/video_detect_logo_gcs.py

Deleting comma :)

Co-Authored-By: Noah Negrey <nnegrey@users.noreply.github.com>

* fixing broken test

* typo

Co-authored-by: Noah Negrey <nnegrey@users.noreply.github.com>
  • Loading branch information
2 people authored and danoscarmike committed Sep 30, 2020
1 parent 2b9003d commit c105c1b
Show file tree
Hide file tree
Showing 13 changed files with 833 additions and 452 deletions.
443 changes: 243 additions & 200 deletions packages/google-cloud-videointelligence/samples/analyze/analyze.py

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -18,43 +18,53 @@

import analyze

POSSIBLE_TEXTS = ['Google', 'SUR', 'SUR', 'ROTO', 'Vice President', '58oo9',
'LONDRES', 'OMAR', 'PARIS', 'METRO', 'RUE', 'CARLO']
POSSIBLE_TEXTS = [
"Google",
"SUR",
"SUR",
"ROTO",
"Vice President",
"58oo9",
"LONDRES",
"OMAR",
"PARIS",
"METRO",
"RUE",
"CARLO",
]


@pytest.mark.slow
def test_analyze_shots(capsys):
analyze.analyze_shots('gs://cloud-samples-data/video/gbikes_dinosaur.mp4')
analyze.analyze_shots("gs://cloud-samples-data/video/gbikes_dinosaur.mp4")
out, _ = capsys.readouterr()
assert 'Shot 1:' in out
assert "Shot 1:" in out


@pytest.mark.slow
def test_analyze_labels(capsys):
analyze.analyze_labels('gs://cloud-samples-data/video/cat.mp4')
analyze.analyze_labels("gs://cloud-samples-data/video/cat.mp4")
out, _ = capsys.readouterr()
assert 'label description: cat' in out
assert "label description: cat" in out


@pytest.mark.slow
def test_analyze_explicit_content(capsys):
analyze.analyze_explicit_content('gs://cloud-samples-data/video/cat.mp4')
analyze.analyze_explicit_content("gs://cloud-samples-data/video/cat.mp4")
out, _ = capsys.readouterr()
assert 'pornography' in out
assert "pornography" in out


@pytest.mark.slow
def test_speech_transcription(capsys):
analyze.speech_transcription(
'gs://cloud-samples-data/video/googlework_short.mp4')
analyze.speech_transcription("gs://cloud-samples-data/video/googlework_short.mp4")
out, _ = capsys.readouterr()
assert 'cultural' in out
assert "cultural" in out


@pytest.mark.slow
def test_detect_text_gcs(capsys):
analyze.video_detect_text_gcs(
'gs://cloud-samples-data/video/googlework_tiny.mp4')
analyze.video_detect_text_gcs("gs://cloud-samples-data/video/googlework_tiny.mp4")
out, _ = capsys.readouterr()

text_exists = False
Expand All @@ -67,7 +77,6 @@ def test_detect_text_gcs(capsys):

@pytest.mark.slow
def test_track_objects_gcs(capsys):
analyze.track_objects_gcs(
'gs://cloud-samples-data/video/cat.mp4')
analyze.track_objects_gcs("gs://cloud-samples-data/video/cat.mp4")
out, _ = capsys.readouterr()
assert 'cat' in out
assert "cat" in out
Loading

0 comments on commit c105c1b

Please sign in to comment.