<commit_before># Vision Analytics Solution Using Dataflow & Vision AI 

This repo contains a reference implementation to derive insights from large scale image files stored in a GCS bucket.  The goal is to provide an easy to use end to end automated solution by using Dataflow and Vision API.  Response from  Vision API  is stored in BigQuery tables based on feature type and can be used as additional features to create machine learning model by using BigQuery ML or Auto ML. 

## Table of Contents  

* [Reference Architecture](#reference-architecture)  
* [Solution Details](#solution-details)
* [Getting Started](#getting-start)
	* [Build](#build)
	* [Flex Template](#flex-template)
* [Test & Validate ](#test-and-validate)
	* [Automated BigQuery tables by feature type](#test-1)
	* [Running label and landmark detection  for Fickr30k dataset](#test-2)
* [Analysis ](#analysis)
	* [Top label for each file](#top-label-by-file) 
	* [Top 10 labels](#top-10-labels)  
	* [Top 10 popular landmarks](#top-10-popular-landmarks)
	* [Images with water falls](#images-with-falls)
	* [Popular parks](#popular-parks)
	
# Reference Architecture

![ref_arch](diagram/vision_analytics_ref_arch.png)

# Solution Details
Manufacturers are facing challenging business disruptions due to the current market environment.  Visual inspection solution is designed to address major pain points for manufacturers looking to improve quality control process or monitor workers safety while reducing cost. This is a generic solution to automate inspection process by using Vision AI and Dataflow.  Solution works as below:

1. Images are uploaded in a GCS bucket from source systems. 
2. An automated  notification is sent out to PubSub topic for processing. 
3. Dataflow pipeline process the image file based on the configurations provided:
	a) Features: List of Vision API features to use for processing
	b) BatchSize: Maximum 16 images /call. This helps to process large scale image files in a performance optimal manner. 
	c) Parallel Processing: Control the number of parallel calls to API to leverage number of quotas (concurrent api calls) for Vision API.<commit_msg>updated ref arch<commit_after># Vision Analytics Solution Using Dataflow & Vision AI 

This repo contains a reference implementation to derive insights from large scale image files stored in a GCS bucket.  The goal is to provide an easy to use end to end automated solution by using Dataflow and Vision API.  Response from  Vision API  is stored in BigQuery tables based on feature type and can be used as additional features to create machine learning model by using BigQuery ML or Auto ML. 

## Table of Contents  

* [Reference Architecture](#reference-architecture)  
* [Solution Details](#solution-details)
* [Getting Started](#getting-start)
	* [Build](#build)
	* [Flex Template](#flex-template)
* [Test & Validate ](#test-and-validate)
	* [Automated BigQuery tables by feature type](#test-1)
	* [Running label and landmark detection  for Fickr30k dataset](#test-2)
* [Analysis ](#analysis)
	* [Top label for each file](#top-label-by-file) 
	* [Top 10 labels](#top-10-labels)  
	* [Top 10 popular landmarks](#top-10-popular-landmarks)
	* [Images with water falls](#images-with-falls)
	* [Popular parks](#popular-parks)
	
# Reference Architecture

![ref_arch](diagram/vision_analytics_dataflow_visionai.png)

# Solution Details
Manufacturers are facing challenging business disruptions due to the current market environment.  Visual inspection solution is designed to address major pain points for manufacturers looking to improve quality control process or monitor workers safety while reducing cost. This is a generic solution to automate inspection process by using Vision AI and Dataflow.  Solution works as below:

1. Images are uploaded in a GCS bucket from source systems. 
2. An automated  notification is sent out to PubSub topic for processing. 
3. Dataflow pipeline process the image file based on the configurations provided:
	a) Features: List of Vision API features to use for processing
	b) BatchSize: Maximum 16 images /call. This helps to process large scale image files in a performance optimal manner. 
	c) Parallel Processing: Control the number of parallel calls to API to leverage number of quotas (concurrent api calls) for Vision API.
{'fraction_non_alphanumeric': 0.06722299490032453, 'fraction_numerical': 0.007881316643486324, 'mean_word_length': 4.807537012113055, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6658586', 'n_tokens_mistral': 1148, 'n_tokens_neox': 1059, 'n_words': 553}