Skip to content

Commit

Permalink
fix:Final Code
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulraghatate committed May 1, 2017
1 parent 213b367 commit fdf3ed1
Show file tree
Hide file tree
Showing 191 changed files with 466 additions and 278 deletions.
152 changes: 120 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,76 +1,150 @@
### STREET-SIGNS DETECTION in VIDEO STREAM OVER SPARK-HADOOP CLUSTER
### STREET-SIGNS DETECTION in VIDEO over SPARK CLUSTER

#### STEP 1: Clone or download cloudmesh.street repository to local machine

git clone https://github.com/cloudmesh/cloudmesh.street.git

#### STEP 2: After getting local copy of the git repository, Go to directory './code/scripts'
#### STEP 2.1: UPDATE THE USER PREFERENCES
After getting local copy of the git repository, Go to directory "./ansible"
UPDATE THE FOLLOWING VARIABLES <TBD values> IN "user_vars.yaml"

---
############################################################
#Variables for execution of complete package

#EDIT FOLLOWING DETAILS AS PER REQUIREMENT

##############CLOUDMESH SETTINGS############################
#cloud: "chameleon" or "jetstream"
cloud: <TBD>
#username: "cloudmesh username as key_name"
username: <TBD>
############HADOOP CLUSTER SETTINGS#########################
#Chameleon image_name: CC-Ubuntu14.04
#jetstream image_name: ubuntu-14.04-trusty-server-cloudimg
#flavor: m1.small, m1.medium, m1.large[preferred: m1.medium]
#addons: spark pig hive

image_name: <TBD>
count: <TBD>
flavor: <TBD>
addons: <TBD>

##########################################################

#### For e.g.:

---
############################################################
#Variables for execution of complete package

#EDIT FOLLOWING DETAILS AS PER REQUIREMENT

##############CLOUDMESH SETTINGS############################
#cloud: "chameleon" or "jetstream"
cloud: "chameleon"
#username: "cloudmesh username as key_name"
username: "rraghata"
############HADOOP CLUSTER SETTINGS#########################
#Chameleon image_name: CC-Ubuntu14.04
#jetstream image_name: ubuntu-14.04-trusty-server-cloudimg
#flavor: m1.small, m1.medium, m1.large [preferred: m1.medium]
#addons: spark pig hive

#### STEP 3: To install ansible, cloudmesh client for the first-time:
(Note: Skip 3.1 if already installed )
##### 3.1 Run the script local_setup.sh from ./code/scripts folder:

image_name: "CC-Ubuntu14.04"
count: "6"
flavor: "m1.medium"
addons: "spark"

############################################################

#### STEP 2.2: CHANGE WORKING DIRECTORY
Go to directory '/cloudmesh.street/code/scripts'

#### STEP 3: To install ansible, cloudmesh client for the first-time and run complete package run following script:

. run_all.sh

#### STEP 3: ANSIBLE PLAYBOOK EXECUTION BREAKDOWN
{Note: Skip 3.1 if already installed )

##### 3.1 Run the script local_setup.sh for ansible and cloudmesh setup on local machine:

. setup.sh

The above script when runs uses playbook--> ansible/local_setup.yaml
Edit the cloudmesh.yaml file as per requirements [DETAILS GIVEN IN APPENDIX]

##### 3.2 Run the script configure.sh from ./code/scripts folder:
##### 3.2 Run the script configure.sh for cloudmesh and cloud configuration:

. configure.sh

The above script when runs uses playbook--> ansible/cloud_config.yaml and ask for user input for following fields:
(Note: Values in [] are default values just press ENTER if requires default configuration)

enter the cloudname[chameleon]:
enter the key_name,preferably cloud_username[TBD]:

The above script when runs uses playbook--> ansible/cloud_config.yaml

##### 3.3 Run the script deploy.sh from ./code/scripts folder:
##### 3.3 Run the script deploy.sh to hadoop-spark cluster:

. deploy.sh

The above script when runs ,uses playbook--> ansible/hadoop_deploy.yaml and ask for user input for following fields:
(Note: Values in [] are default values just press ENTER if requires default configuration)
enter image_name[CC-Ubuntu14.04]:
enter the no. of nodes[3]:
enter the flavor requried[m1.medium]:
enter the addons required[spark pig]:

##### 3.4 Run the script opencv_setup.sh from ./code/scripts folder:
The above script when runs ,uses playbook--> ansible/hadoop_deploy.yaml

##### 3.4 Run the script opencv_setup.sh for environment setup over cloud cluster for opencv and pyspark:

. opencv_setup.sh

The above script when runs ,uses playbook--> ansible/opencv_setup.yaml

##### 3.5 Run the script sifn_detection.sh from ./code/scripts folder:
##### 3.5 Run the script sign_detection.sh to perform the sign detection analysis over cloud spark cluster:

. sign_detection.sh

The above script when runs ,uses playbook--> ansible/sign_detection.yaml

##### 3.6 Run the script transfer.sh from ./code/scripts folder:
##DEFAULT:
As the images dataset as well as sample video is present in project directory[DETAILS IN APPENDIX], The default program performs sign detection on images.

To perform video analysis, Update the following file for last task:

cloudmesh.street/ansible/roles/analysis/tasks/mail.yml

with

su - hadoop -c "spark-submit --master yarn --deploy-mode client --executor-memory 1g --driver-memory 2g --name signdetection --conf "spark.app.id=signdetection" /opencv_workspace/code/signdetectionbyspark.py /opencv_workspace/test_data/videos/ /opencv_workspace/output/"

##### 3.6 Run the script transfer.sh to get the output from remote vms(cloud) to local machine for visual confirmation:

. transfer.sh

The above script when runs ,uses playbook--> ansible/transfer_output_to_local.yaml

##### 3.7 Run the script clean.sh from ./code/scripts folder:

The output gets stored at "cloudmesh.street/ansible/output"

##### 3.7 Run the script clean.sh to clean the environment:

. clean.sh

The above script when runs ,uses playbook--> env_clean.yaml

It deletes all the VMS, undefines all the clusters, delete the output directory and deletes the stacks.

##### 4. BENCHMARK
##### 4.1 UPDATE the ./ansible/user_vars.yaml with preferences
##### 4.2 GO TO Directory ./benchmark and run below script:

. benchmark.sh

The above script runs all the scripts[from ../code/scripts] with output in "./benchmark/benchmark_time" file for every script


## Appendix:
#### A.1 Use of Cloudmesh_client

##### A.1.1 Edit ~/.cloudmesh/cloudmesh.yaml for following sections, edit <''>/ <TBD> in the file correct credentials:

profile:
firstname: <first name>
lastname: <last name>
email: <email id>
user: <chameleon/jetsream/other cloud username>
profile:
firstname: <first name>
lastname: <last name>
email: <email id>
user: <chameleon/jetsream/other cloud username>

##### A.1.2 Change the entry of active cloud for the one you need,For e.g. chameleon cloud as shown below

Expand All @@ -79,7 +153,7 @@ The above script when runs ,uses playbook--> env_clean.yaml
clouds:
...

##### A.1.3 Edit the configuration for the active cloud below it from the list(kilo/chameleon/jestream/..), the entry with < > should be customized as per your credentials.
##### A.1.3 Edit the configuration for the active cloud below it from the list(kilo/chameleon/jestream/..), the entry with <TBD> should be customized as per your credentials.

Chameleon Example:

Expand All @@ -95,3 +169,17 @@ Chameleon Example:
default:
flavor: m1.medium
image: CC-Ubuntu14.04
#### A.2 DATA
##### A.2.1 Test Data has been provided in "ansible/roles/analysis/files/test_data/"
Following directories are included as sample test-data:

./images/ - 50 images dataset
./videos/ - 1 video stop_video_1.mp4 (2 sec)

#### A.3 CLASSIFIER
"STOP SIGN CLASSIFIER" has been provided in "ansible/roles/analysis/files/classifier/"
##### A.3.1 For testing,only one classifier-"STOP SIGN" has been used.
Multiple classifiers can be added to the directory if you have.

### A.3.2 Above classifier was taken from <https://github.com/markgaynor/stopsigns/tree/master/classifier>.

7 changes: 0 additions & 7 deletions ansible/benchmark_time

This file was deleted.

12 changes: 11 additions & 1 deletion ansible/inventory.txt
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@

[localhost]
localhost ansible_connection=local
[remote]
rraghata-055 ansible_ssh_host="129.114.33.8" ansible_ssh_user="cc"
rraghata-056 ansible_ssh_host="129.114.33.98" ansible_ssh_user="cc"
rraghata-057 ansible_ssh_host="129.114.32.247" ansible_ssh_user="cc"
rraghata-058 ansible_ssh_host="129.114.33.95" ansible_ssh_user="cc"
rraghata-059 ansible_ssh_host="129.114.110.127" ansible_ssh_user="cc"
rraghata-060 ansible_ssh_host="129.114.33.229" ansible_ssh_user="cc"
[master]
rraghata-055 ansible_ssh_host="129.114.33.8" ansible_ssh_user="cc"
Binary file added ansible/output/output/1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ansible/output/output/10.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ansible/output/output/100.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ansible/output/output/101.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ansible/output/output/102.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ansible/output/output/103.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ansible/output/output/104.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ansible/output/output/105.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ansible/output/output/106.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ansible/output/output/107.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ansible/output/output/108.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ansible/output/output/109.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ansible/output/output/11.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ansible/output/output/110.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ansible/output/output/111.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ansible/output/output/112.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ansible/output/output/113.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ansible/output/output/114.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ansible/output/output/115.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ansible/output/output/116.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ansible/output/output/117.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ansible/output/output/118.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ansible/output/output/119.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ansible/output/output/12.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ansible/output/output/120.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ansible/output/output/13.jpg
Binary file added ansible/output/output/14.jpg
Binary file added ansible/output/output/15.jpg
Binary file added ansible/output/output/16.jpg
Binary file added ansible/output/output/17.jpg
Binary file added ansible/output/output/18.jpg
Binary file added ansible/output/output/19.jpg
Binary file added ansible/output/output/2.jpg
Binary file added ansible/output/output/20.jpg
Binary file added ansible/output/output/21.jpg
Binary file added ansible/output/output/22.jpg
Binary file added ansible/output/output/23.jpg
Binary file added ansible/output/output/24.jpg
Binary file added ansible/output/output/25.jpg
Binary file added ansible/output/output/26.jpg
Binary file added ansible/output/output/27.jpg
Binary file added ansible/output/output/28.jpg
Binary file added ansible/output/output/29.jpg
Binary file added ansible/output/output/3.jpg
Binary file added ansible/output/output/30.jpg
Binary file added ansible/output/output/31.jpg
Binary file added ansible/output/output/32.jpg
Binary file added ansible/output/output/33.jpg
Binary file added ansible/output/output/34.jpg
Binary file added ansible/output/output/35.jpg
Binary file added ansible/output/output/36.jpg
Binary file added ansible/output/output/37.jpg
Binary file added ansible/output/output/38.jpg
Binary file added ansible/output/output/39.jpg
Binary file added ansible/output/output/4.jpg
Binary file added ansible/output/output/40.jpg
Binary file added ansible/output/output/41.jpg
Binary file added ansible/output/output/42.jpg
Binary file added ansible/output/output/43.jpg
Binary file added ansible/output/output/44.jpg
Binary file added ansible/output/output/45.jpg
Binary file added ansible/output/output/46.jpg
Binary file added ansible/output/output/47.jpg
Binary file added ansible/output/output/48.jpg
Binary file added ansible/output/output/49.jpg
Binary file added ansible/output/output/5.jpg
Binary file added ansible/output/output/50.jpg
Binary file added ansible/output/output/51.jpg
Binary file added ansible/output/output/52.jpg
Binary file added ansible/output/output/53.jpg
Binary file added ansible/output/output/54.jpg
Binary file added ansible/output/output/55.jpg
Binary file added ansible/output/output/56.jpg
Binary file added ansible/output/output/57.jpg
Binary file added ansible/output/output/58.jpg
Binary file added ansible/output/output/59.jpg
Binary file added ansible/output/output/6.jpg
Binary file added ansible/output/output/60.jpg
Binary file added ansible/output/output/61.jpg
Binary file added ansible/output/output/62.jpg
Binary file added ansible/output/output/63.jpg
Binary file added ansible/output/output/64.jpg
Binary file added ansible/output/output/65.jpg
Binary file added ansible/output/output/66.jpg
Binary file added ansible/output/output/67.jpg
Binary file added ansible/output/output/68.jpg
Binary file added ansible/output/output/69.jpg
Binary file added ansible/output/output/7.jpg
Binary file added ansible/output/output/70.jpg
Binary file added ansible/output/output/71.jpg
Binary file added ansible/output/output/72.jpg
Binary file added ansible/output/output/73.jpg
Binary file added ansible/output/output/74.jpg
Binary file added ansible/output/output/75.jpg
Binary file added ansible/output/output/76.jpg
Binary file added ansible/output/output/77.jpg
Binary file added ansible/output/output/78.jpg
Binary file added ansible/output/output/79.jpg
Binary file added ansible/output/output/8.jpg
Binary file added ansible/output/output/80.jpg
Binary file added ansible/output/output/81.jpg
Binary file added ansible/output/output/82.jpg
Binary file added ansible/output/output/83.jpg
Binary file added ansible/output/output/84.jpg
Binary file added ansible/output/output/85.jpg
Binary file added ansible/output/output/86.jpg
Binary file added ansible/output/output/87.jpg
Binary file added ansible/output/output/88.jpg
Binary file added ansible/output/output/89.jpg
Binary file added ansible/output/output/9.jpg
Binary file added ansible/output/output/90.jpg
Binary file added ansible/output/output/91.jpg
Binary file added ansible/output/output/92.jpg
Binary file added ansible/output/output/93.jpg
Binary file added ansible/output/output/94.jpg
Binary file added ansible/output/output/95.jpg
Binary file added ansible/output/output/96.jpg
Binary file added ansible/output/output/97.jpg
Binary file added ansible/output/output/98.jpg
Binary file added ansible/output/output/99.jpg
2 changes: 1 addition & 1 deletion ansible/roles/analysis/files/code/signdetectionbyspark.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def process_images(image):
if (imageDir != '/opencv_workspace/test_data/images/'):
imageDir = video2image(imageDir)
print(imageDir)
pd = sc.parallelize(paths.list_images(imageDir),100)
pd = sc.parallelize(paths.list_images(imageDir),60)
pdc = pd.map(process_images)
result = pdc.collect()

Expand Down
45 changes: 0 additions & 45 deletions ansible/roles/analysis/files/code/signdetectionbyspark_images.py

This file was deleted.

25 changes: 0 additions & 25 deletions ansible/roles/analysis/files/code/test_video.py

This file was deleted.

Binary file not shown.
Binary file not shown.
51 changes: 0 additions & 51 deletions ansible/roles/analysis/main.yml

This file was deleted.

Loading

0 comments on commit fdf3ed1

Please sign in to comment.