FIT5225代做、Web Service代做、Python代写、代做Python程序语言代做Java程序|调试Matlab程序

Assignment 1
FIT5225 2020 SM1
iWebLens:
Creating and Deploying an Image Object Detection
Web Service within a Containerised Environment
1 Synopsis and Background
This project aims at building a web-based system that we call it iWebLens. It allows end-users to send
an image to a web service hosted in a Docker container and receive a list of objects detected in their
uploaded image. The project makes use of YOLO (You only look once) library, a state-of-the-art real-time
object detection system, and OpenCV (Open-Source Computer Vision Library) to perform required image
operations/transformations. Both YOLO and OpenCV are python-based open-source computer vision and
machine learning software libraries. Kubernetes is used as the container orchestration system. The object
detection web service is also designed using a RESTful API that can use Python’s FLASK library. We
are interested in examining the performance of iWebLens by varying the number of requests sent to the
system (demand) and the number of existing Pods within the Kubernetes cluster (resources).
This assignment has the following objectives:
• Writing a python web service that accepts images, uses YOLO and OpenCV to process images, and
returns a JSON object with a list of detected objects.
• Building a Docker Image for the object detection web service.
• Creating a Kubernetes cluster on a virtual machine (instance) in the Nectar cloud.
• Deploying a Kubernetes service to distribute inbound requests among pods that are running the
object detection service.
• Testing the system under different load and number of pods.
You can focus on these objectives one after the other to secure partial marks.
2 The web service - [20 Marks]
You are supposed to develop a RESTful API that allows the client to upload images to the server. You
can use Flask to build your web service and any port over 1024. Each image is sent to the web service
using an HTTP POST request and the client script for sending images to the web service is given to you.
The web service creates a thread per request and uses YOLO and OpenCV python libraries to detect
objects in the image. Then, for each image (request) it returns a JSON object with a list of all objects
detected in that image as follows:
1
{"objects": [
{ "label":"human/book/cat/...","accuracy":"a number between 0-100"},...]}
A sample response:
{"objects": [
{ "label":"book","accuracy":"99.45"},
{ "label":"book","accuracy":"70.34"},
{ "label":"cat","accuracy":"50.20"},
{ "label":"monitor","accuracy":"88.20"}]}
You only need to build the server-side RESTful API. We provide the client script (iWebLens_client.py
file) that is designed to invoke the REST API with a different number of simultaneous requests. Please
make sure your web service is fully compatible with requests sent by the given client script.
For object detection, you are encouraged to utilise the pre-trained network weights (no need to train
the object detection program yourself). Due to limited resources in Nectar, we strongly recommend you
to use the yolov3-tiny framework to develop a fast and reliable RESTful API. Please find the sample
network weights for yolov3-tiny at https://pjreddie.com/media/files/yolov3-tiny.weights. Required
configuration files and more information can be found at https://github.com/pjreddie/darknet,
https://github.com/pjreddie/darknet/tree/master/cfg. Note that this network is trained on COCO
dataset (http://cocodataset.org/#home). We also provide a sample group of images (128 images in
inputfolder) from this dataset and you shall use it for testing. For your reference, the full dataset can be
found at http://images.cocodataset.org/zips/test2017.zip. Please extract the given client.zip
file and you can find inputfolder and iWebLens_client.py along with a readme file explaining how you
can use them. You can invoke the program as follows:
python iWebLens_client.py
Here, inputfolder represents the folder that contains 128 images for the test. The endpoint is the REST
API URL and num_threads indicates the number of parallel requests submitted to your server. Please
refer to the client script iWebLens_client.py and ReadMe.txt file for more details. Here is a sample:
python iWebLens_client.py /inputfolder http://118.138.43.2:5000/api/object_detection 16
3 Dockerfile - [20 Marks]
Docker builds images by reading the instructions from a file known as Dockerfile. Dockerfile is a text file
that contains all ordered commands needed to build a given image. You are supposed to build a Dockerfile
that includes all the required instructions to build your Docker image. You can find Dockerfile reference
documentation here: https://docs.docker.com/engine/reference/builder/
2
4 Kubernetes Cluster - [20 Marks]
The default quota of your personal project (pt) in Nectar only allows you to use 2 VCPUs. A real
Kubernetes cluster with multiple physical nodes requires more resources. You are tasked to install a
cluster on a single VM. For this purpose, you are going to use Kind, a tool for running local Kubernetes
clusters on a single machine using Docker container nodes, to create a Kubernetes cluster with 1 controller
and 1 worker node that run on the same VM (Choose the m3.small flavor). Make sure you only create
one cluster and it is configured properly.
Kind uses Docker to set up and initialise a Kube cluster for you; therefore, you need to create a VM
that uses Nectar Ubuntu 18.04 with Docker as its boot image and then follow Kind’s quick start guide
that is available here: https://kind.sigs.k8s.io/docs/user/quick-start.
5 Kubernetes Service - [20 Marks]
After you have a running Kubernetes cluster, you need to create service and deployment configurations
that will in turn create and deploy required pods in the cluster. The official documentation of Kubernetes
contains various resources on how to create pods from a Docker image, set CPU and/or memory limitations
and the steps required to create a deployment for your pods using selectors. Please make sure you set CPU
request and CPU limit to “0.5” for each pod. Initially, you will start with a single pod to test your web
service and gradually increase the number of pods to 3 in the Section 6. The preferred way of achieving
this is by creating replica sets and scaling them accordingly. Below is a sample Kubernetes deployment
that configures the CPU capabilities for pods:
apiVersion: apps/v1
Finally, you need to expose your deployment in order to communicate with the web service that is
running inside your pods. You need to call the object detection service from your computer (PC or
Desktop); hence you can leverage Nodeport capabilities of kubernetes to expose your deployment.
The Nectar pt project restricts access to many ports and limits access for some IP ranges even if you
open those ports to the public in your security group. It is recommended that you map a well-known port
(for example 80 or 8080) from your Nectar instance to your Kubernetes service port to avoid any issue.
6 Experiments - [20 Marks]
Your next objective is to test your system under a varying workload and with a different number of
resources. When the system is up and running, you will run experiments to test the impact of number
of pods (available resources) and number of threads (simultaneous requests) on the response time of the
service. Response time of a service is the period between when an end-user makes a request until a response
is sent back to the end-user. The iWebLens_client.py script automatically measures the average response
time for you and prints it at the end of its execution.
The number of pods must be scaled to 1, 2, and 3. Since the amount of CPU allocated to each pod
is limited, by increasing the number of pods, you will increase the amount of resources that is available
to your web service. You will also vary the number of concurrent threads at the client-side to analyse the
impact of multi-threading/simultaneous requests on the overall average response time of the service. To
do so, you vary the num_threads argument of iWebLens_client.py script to 1,2,4,8,16, and 32. This way
you will run a total of 3 × 6 = 18 experiments. For each run, 128 images will be sent to the server and
average response time is collected. To make your collected data points more reliable, you should run each
experiment multiple times, calculate and report the average response time.
Your task is to create a 2-D line plot with 6 lines each for a different number of threads (1,2,4,8,16,
and 32), the x-axis represents the number of pods (1,2, and 3), and the y-axis represents the mean of the
average response time in seconds. It is recommended to repeat experiments at least three times. In your
report, discuss this plot and your observations.
To automate your experimentation and collect data points, you can write a script that automatically
varies the parameters for the experiments and collects data points.
7 Report
Your report must be a maximum of 2 pages. You need to include the following in your report:
• A single plot showing the average response time of the web service versus the number of pods for a
different number of threads (Simultaneous request).
• Maximum of 500 words explaining trends and justifying observations in your experiments.
Use 12pt Times font, single column, 1-inch margin all around. Put your full name, your tutor name,
login name, and student number at the top of your report.
8 Technical aspects
• You can use any programming language. Note that the majority of this project description is written
based on Python.
• Make sure you install all the required packages wherever needed. For example, python, Yolov3-tiny,
opencv-python, flask, numpy and etc.
• You should use your desktop or laptop machine to generate client requests. When you are running
experiments, do not use your bandwidth for other network activities, e.g. Watching Youtube, as it
might affect your result.
• You should set up your Kubernetes cluster within a single 2-core VM in the Nectar pt project.
• Make sure your Kubernetes service properly distributes tasks between pods (check logs).
• Make sure you limit the CPU capacity for each pod (0.5).
9 Submission
You need to submit a zip file containing the following via Moodle:
• Your Dockerfile.
• Your web service source code.
• Your Kubernetes deployment and service configurations.
• Any script that automates running experiments if you have one.
• A ReadMe.txt file with a link to a 5-minute video discussing each objective while demonstrating your
system (You can use YouTube). Please make sure the video is public and we can access it easily. If
you would like to inform us regarding anything else you can use this ReadMe file.
• A report in PDF format as requested.
Submissions are due on Monday, 11 May at 11:59PM AEST.

热门主题

课程名

mktg2509 csci 2600 38170 lng302 csse3010 phas3226 77938 arch1162 engn4536/engn6536 acx5903 comp151101 phl245 cse12 comp9312 stat3016/6016 phas0038 comp2140 6qqmb312 xjco3011 rest0005 ematm0051 5qqmn219 lubs5062m eee8155 cege0100 eap033 artd1109 mat246 etc3430 ecmm462 mis102 inft6800 ddes9903 comp6521 comp9517 comp3331/9331 comp4337 comp6008 comp9414 bu.231.790.81 man00150m csb352h math1041 eengm4100 isys1002 08 6057cem mktg3504 mthm036 mtrx1701 mth3241 eeee3086 cmp-7038b cmp-7000a ints4010 econ2151 infs5710 fins5516 fin3309 fins5510 gsoe9340 math2007 math2036 soee5010 mark3088 infs3605 elec9714 comp2271 ma214 comp2211 infs3604 600426 sit254 acct3091 bbt405 msin0116 com107/com113 mark5826 sit120 comp9021 eco2101 eeen40700 cs253 ece3114 ecmm447 chns3000 math377 itd102 comp9444 comp(2041|9044) econ0060 econ7230 mgt001371 ecs-323 cs6250 mgdi60012 mdia2012 comm221001 comm5000 ma1008 engl642 econ241 com333 math367 mis201 nbs-7041x meek16104 econ2003 comm1190 mbas902 comp-1027 dpst1091 comp7315 eppd1033 m06 ee3025 msci231 bb113/bbs1063 fc709 comp3425 comp9417 econ42915 cb9101 math1102e chme0017 fc307 mkt60104 5522usst litr1-uc6201.200 ee1102 cosc2803 math39512 omp9727 int2067/int5051 bsb151 mgt253 fc021 babs2202 mis2002s phya21 18-213 cege0012 mdia1002 math38032 mech5125 07 cisc102 mgx3110 cs240 11175 fin3020s eco3420 ictten622 comp9727 cpt111 de114102d mgm320h5s bafi1019 math21112 efim20036 mn-3503 fins5568 110.807 bcpm000028 info6030 bma0092 bcpm0054 math20212 ce335 cs365 cenv6141 ftec5580 math2010 ec3450 comm1170 ecmt1010 csci-ua.0480-003 econ12-200 ib3960 ectb60h3f cs247—assignment tk3163 ics3u ib3j80 comp20008 comp9334 eppd1063 acct2343 cct109 isys1055/3412 math350-real math2014 eec180 stat141b econ2101 msinm014/msing014/msing014b fit2004 comp643 bu1002 cm2030
联系我们
EMail: 99515681@qq.com
QQ: 99515681
留学生作业帮-留学生的知心伴侣!
工作时间:08:00-21:00
python代写
微信客服:codinghelp
站长地图