Skip to content

I am using Video Intelligence API testing with a local file of my machine following the example of github but it is not returning any type of information. #1102

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

Closed
joaodematejr opened this issue May 16, 2018 · 6 comments
Assignees

Comments

@joaodematejr
Copy link

joaodematejr commented May 16, 2018

In which file did you encounter the issue?
Video Intelligence API

Did you change the file? If so, how?
no. running on wildfly 10 in java 1.8

Describe the issue
// Call
public String consult() throws Throwable {
//file link
analyzeLabelsFile("C:\Videos\cat.mp4");
return "analiseForenseVideos.xhtml";

}

public static void analyzeLabelsFile(String filePath) throws Exception {
try (VideoIntelligenceServiceClient client = VideoIntelligenceServiceClient.create()) {
// Read file and encode into Base64
Path path = Paths.get(filePath);
byte[] data = Files.readAllBytes(path);
byte[] encodedBytes = Base64.encodeBase64(data);

	AnnotateVideoRequest request = AnnotateVideoRequest.newBuilder()
	.setInputContent(ByteString.copyFrom(encodedBytes)).addFeatures(Feature.LABEL_DETECTION).build();

		// Create an operation that will contain the response when the operation
		// completes.
	OperationFuture<AnnotateVideoResponse, AnnotateVideoProgress> response = client.annotateVideoAsync(request);

	System.out.println("Waiting for operation to complete...");
	for (VideoAnnotationResults results : response.get().getAnnotationResultsList()) {
			// process video / segment level label annotations
		System.out.println("Locations: ");
		for (LabelAnnotation labelAnnotation : results.getSegmentLabelAnnotationsList()) {
			System.out.println("Video label: " + labelAnnotation.getEntity().getDescription());
				// categories
			for (Entity categoryEntity : labelAnnotation.getCategoryEntitiesList()) {
				System.out.println("Video label category: " + categoryEntity.getDescription());
			}
				// segments
			for (LabelSegment segment : labelAnnotation.getSegmentsList()) {
				double startTime = segment.getSegment().getStartTimeOffset().getSeconds()
				+ segment.getSegment().getStartTimeOffset().getNanos() / 1e9;
				double endTime = segment.getSegment().getEndTimeOffset().getSeconds()
				+ segment.getSegment().getEndTimeOffset().getNanos() / 1e9;
				System.out.printf("Segment location: %.3f:%.2f\n", startTime, endTime);
				System.out.println("Confidence: " + segment.getConfidence());
			}
		}

			// process shot label annotations
		for (LabelAnnotation labelAnnotation : results.getShotLabelAnnotationsList()) {
			System.out.println("Shot label: " + labelAnnotation.getEntity().getDescription());
				// categories
			for (Entity categoryEntity : labelAnnotation.getCategoryEntitiesList()) {
				System.out.println("Shot label category: " + categoryEntity.getDescription());
			}
				// segments
			for (LabelSegment segment : labelAnnotation.getSegmentsList()) {
				double startTime = segment.getSegment().getStartTimeOffset().getSeconds()
				+ segment.getSegment().getStartTimeOffset().getNanos() / 1e9;
				double endTime = segment.getSegment().getEndTimeOffset().getSeconds()
				+ segment.getSegment().getEndTimeOffset().getNanos() / 1e9;
				System.out.printf("Segment location: %.3f:%.2f\n", startTime, endTime);
				System.out.println("Confidence: " + segment.getConfidence());
			}
		}

			// process frame label annotations
		for (LabelAnnotation labelAnnotation : results.getFrameLabelAnnotationsList()) {
			System.out.println("Frame label: " + labelAnnotation.getEntity().getDescription());
				// categories
			for (Entity categoryEntity : labelAnnotation.getCategoryEntitiesList()) {
				System.out.println("Frame label category: " + categoryEntity.getDescription());
			}
				// segments
			for (LabelSegment segment : labelAnnotation.getSegmentsList()) {
				double startTime = segment.getSegment().getStartTimeOffset().getSeconds()
				+ segment.getSegment().getStartTimeOffset().getNanos() / 1e9;
				double endTime = segment.getSegment().getEndTimeOffset().getSeconds()
				+ segment.getSegment().getEndTimeOffset().getNanos() / 1e9;
				System.out.printf("Segment location: %.3f:%.2f\n", startTime, endTime);
				System.out.println("Confidence: " + segment.getConfidence());
			}
		}
	}
}

}
}

what is returning on the console

11:35:14,533 INFO [stdout] (default task-12) Waiting for operation to complete...
11:52:12,493 INFO [stdout] (default task-12) Locations:

@MounaBC
Copy link

MounaBC commented Jun 15, 2018

I'm having the same issue. Did you find the solution please?

@joaodematejr
Copy link
Author

No, the problem seems to be in the analyzeLabelsFile class in the Detect.java file, I am waiting for some update by google.

@nnegrey
Copy link
Contributor

nnegrey commented Sep 19, 2018

Does this issue also occur with the file located on GCS or just local files?

mvn exec:java -DDetect -Dexec.args="labels gs://demomaker/cat.mp4"

@nnegrey nnegrey self-assigned this Sep 19, 2018
@MounaBC
Copy link

MounaBC commented Sep 19, 2018

When I tested this about 2 months ago, I only had problems with local files. It worked fine on files from gcs. I dont know if any updates were made since then.

@nnegrey
Copy link
Contributor

nnegrey commented Sep 20, 2018

Looked into it.

I was told that "binary data through gRPC is not supposed to be encode64 at all. Only JSON request needs that."

I've made a PR to fix that sample: #1216

Sorry about that. Let me know if there's anything else!

@nnegrey nnegrey closed this as completed Sep 20, 2018
@joaodematejr
Copy link
Author

The problem was only when I was going to send the file from the local machine, the tests done directly with the GCS file return the information.

Shabirmean pushed a commit that referenced this issue Nov 17, 2022
…1.0 (#1102)

[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [com.google.cloud:libraries-bom](https://cloud.google.com/java/docs/bom) ([source](https://togithub.com/GoogleCloudPlatform/cloud-opensource-java)) | `25.0.0` -> `25.1.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/25.1.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/25.1.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/25.1.0/compatibility-slim/25.0.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/25.1.0/confidence-slim/25.0.0)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Renovate will not automatically rebase this PR, because other commits have been found.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-automl).
Shabirmean pushed a commit that referenced this issue Nov 18, 2022
…1.0 (#1102)

[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [com.google.cloud:libraries-bom](https://cloud.google.com/java/docs/bom) ([source](https://togithub.com/GoogleCloudPlatform/cloud-opensource-java)) | `25.0.0` -> `25.1.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/25.1.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/25.1.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/25.1.0/compatibility-slim/25.0.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/25.1.0/confidence-slim/25.0.0)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Renovate will not automatically rebase this PR, because other commits have been found.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-automl).
anguillanneuf pushed a commit that referenced this issue Dec 5, 2022
…1.0 (#1102)

[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [com.google.cloud:libraries-bom](https://cloud.google.com/java/docs/bom) ([source](https://togithub.com/GoogleCloudPlatform/cloud-opensource-java)) | `25.0.0` -> `25.1.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/25.1.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/25.1.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/25.1.0/compatibility-slim/25.0.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/25.1.0/confidence-slim/25.0.0)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Renovate will not automatically rebase this PR, because other commits have been found.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-automl).
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

No branches or pull requests

3 participants