Course material for the Multi-agents and computer graphics course

Overview

TC2008B

Course material for the Multi-agents and computer graphics course.

Setup instructions

  • Strongly recommend using a custom conda environment.
  • Install python 3.8 in the environment: conda install python=3.8 Using 3.8 for compatibility reasons. Maybe 3.9 or 3.10 are compatible with all the packages, but will have to check.
  • Installing mesa: pip install mesa
  • Installing flask to mount the service: pip install flask
  • By this moment, the environment will have all the packages needed for the project to run.

Instructions to run the local server and the Unity application

  • Run either the python web server: Server/tc2008B_server.py, or the flask server: Server/tc2008B_flask.py. Flask is considerably easier to setup and use, and I strongly recommend its use over python's http.server module. Additionally, IBM cloud example used flask.
  • To run the python web server:
python tc2008B_server.py
  • To run a flask app:
export FLASK_APP=tc_2008B_flash.py
flask run
  • You can change the name of the app you want to run by changing the environment variable FLASK_APP.

  • Alternatively, if you used the following code in your flask server:

if __name__=='__main__':
    app.run(host="localhost", port=8585, debug=True)

you can run it using:

python tc2008B_flask.py
  • To run a flask app on a different host or port:
flask run --host=0.0.0.0 --port=8585
  • Either of these servers is what will run on the cloud.
  • Once the server is running, launch the Unity scene TC2008B that is in the folder: IntegrationTest.
  • The scene has two game objects: AgentController and AgentControllerUpdate. I left both so that different functionality can be tested: AgentController works with the response of the python web server, while AgentControllerUpdate works with the reponse from the flask server.
  • I updated the AgentController.cs code, and introduced AgentControllerUpdate.cs. Each script parses data differently, depending on the response from either the python web server, or from the flask server. The AgentController.cs script parses text data, while AgentControllerUpdate.cs parses JSON data. I strongly recommend that we use JSON data.
  • The scripts are listening to port 8585 (http://localhost:8585). Double check that your server is launching on that port; specially if you are using a flask server.
  • If the Unity application is not running, or has import issues, I included the Unity package that has the scene Sergio Ruiz provided.

Instruction to run the cloud server and Unity application

Installing dependencies, and locally running the sample

# ...first add the Cloud Foundry Foundation public key and package repository to your system
wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add -
echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list
# ...then, update your local package index, then finally install the cf CLI
sudo apt update
sudo apt install cf8-cli
  • To get the sample app running:
git clone https://github.com/IBM-Cloud/get-started-python
cd get-started-python
  • To run locally:
pip install -r requirements.txt
python hello.py

To deply the sample to the cloud

  • All the requiered files for the sample app to run are inside the IBMCloud folder.
  • We first need a manifest.yml file. The one provided in the example repository contains the following:
applications:
 - name: GetStartedPython
   random-route: true
   memory: 128M
  • You can use the Cloud Foundry CLI to deploy apps. Choose your API endpoint:
cf api 
   

   

Replace the API-endpoint in the command with an API endpoint from the following list:

URL Region
https://api.ng.bluemix.net US South
https://api.eu-de.bluemix.net Germany
https://api.eu-gb.bluemix.net United Kingdom
https://api.au-syd.bluemix.net Sydney
  • Login to your IBM Cloud account:
cf login
  • From within the get-started-python directory push your app to IBM Cloud:
cf push
  • This process can take a while. All the dependencies are downloaded and installed, and the app in started.
  • After you push the application, in the cloud dashboard you can see a new cloud foundry app.
  • This can take a minute. If there is an error in the deployment process you can use the command cf logs --recent to troubleshoot.
  • When deployment completes you should see a message indicating that your app is running. View your app at the URL listed in the output of the push command. You can also issue the cf apps.
  • With the cf apps command you can see the route for the app.

To deploy a custom app to the cloud

  • I created an app within the cloud foundry in the ibm cloud by following the document Manual IBM Cloud - Python.pdf.
  • Created an additional folder inside the IBMCloud folder, named boids, that contains the required files.
  • In the manifest.yml I renamed the name to the one I used for the app in cloud foundry. From GetStartedPython to Boids.
  • Then, modified the ProcFile file as follows:
web: python tc2008B_flask.py
  • Modified the setup.py file, but I do not think it matters.
  • Then changed to the boids folder, and used:
cf push
  • Then, update the url for the service in Unity with the url for the service that cloud foundry assigns.

Notes

  • Using VSCode to develop everything.
  • Although not stated in the requirements, Git needs to be installed on the system.
  • I am running windows, and using the WSL. I ran the server code in WSL, and the Unity client in windows. My WSL machine runs Ubuntu 20.
  • Using Thunder Client extension as a replacement for postman to test the apis.
  • Pip does not allow us to search anymore.
  • As of 2021-10-17, the WWWForm method to post from Unity to the web service still works with Unity 20.20.3.4. However, the support apparently is going away soon.
  • Using flask because it is ideal for building smaller applications. Django could be used, but since it is much more robust, the additional utilities were not needed for this project.
  • The demo app push process went rather smoothly, but for the boids app it did not. It took too long, and ended up failing with a timeout error. I issued the command again.
  • Timeout again. Modified the manifest, and tried again.
  • After that, the app failed when it tried to start. Apparently, numpy was missing from the requirements.

TO DO

  • [ x ] Add the mesa code instead of the Boids code.
  • [ x ] Check synchronization, clients, maybe in the cloud, most likely in flask
  • Check cloud documentation or ask for a course? Instances, connections, etc.

Dependencies

Automatically resolve RidderMaster based on TensorFlow & OpenCV

AutoRiddleMaster Automatically resolve RidderMaster based on TensorFlow & OpenCV 基于 TensorFlow 和 OpenCV 实现的全自动化解御迷士小马谜题 Demo How to use Deploy the ser

神龙章轩 5 Nov 19, 2021
Python tool that takes the OCR.space JSON output as input and draws a text overlay on top of the image.

OCR.space OCR Result Checker = Draw OCR overlay on top of image Python tool that takes the OCR.space JSON output as input, and draws an overlay on to

a9t9 4 Oct 18, 2022
Document Layout Analysis

Eynollah Document Layout Analysis Introduction This tool performs document layout analysis (segmentation) from image data and returns the results as P

QURATOR-SPK 198 Dec 29, 2022
An interactive interface for using OpenCV's GrabCut algorithm for image segmentation.

Interactive GrabCut An interactive interface for using OpenCV's GrabCut algorithm for image segmentation. Setup Install dependencies: pip install nump

Jason Y. Zhang 16 Oct 10, 2022
nofacedb/faceprocessor is a face recognition engine for NoFaceDB program complex.

faceprocessor nofacedb/faceprocessor is a face recognition engine for NoFaceDB program complex. Tech faceprocessor uses a number of open source projec

NoFaceDB 3 Sep 06, 2021
Code release for Hu et al., Learning to Segment Every Thing. in CVPR, 2018.

Learning to Segment Every Thing This repository contains the code for the following paper: R. Hu, P. Dollár, K. He, T. Darrell, R. Girshick, Learning

Ronghang Hu 417 Oct 03, 2022
📷 This repository is focused on having various feature implementation of OpenCV in Python.

📷 This repository is focused on having various feature implementation of OpenCV in Python. The aim is to have a minimal implementation of all OpenCV features together, under one roof.

Aditya Kumar Gupta 128 Dec 04, 2022
[BMVC'21] Official PyTorch Implementation of Grounded Situation Recognition with Transformers

Grounded Situation Recognition with Transformers Paper | Model Checkpoint This is the official PyTorch implementation of Grounded Situation Recognitio

Junhyeong Cho 18 Jul 19, 2022
Rubik's Cube in pygame with OpenGL

Rubik Rubik's Cube in pygame with OpenGL The script show on the screen a Rubik Cube buit with OpenGL. Then I have also implemented all the possible mo

Gabro 2 Apr 15, 2022
Use Youdao OCR API to covert your clipboard image to text.

Alfred Clipboard OCR 注:本仓库基于 oott123/alfred-clipboard-ocr 的逻辑用 Python 重写,换用了有道 AI 的 API,准确率更高,有效防止百度导致隐私泄露等问题,并且有道 AI 初始提供的 50 元体验金对于其资费而言个人用户基本可以永久使用

Junlin Liu 6 Sep 19, 2022
Here use convulation with sobel filter from scratch in opencv python .

Here use convulation with sobel filter from scratch in opencv python .

Tamzid hasan 2 Nov 11, 2021
Aloception is a set of package for computer vision: aloscene, alodataset, alonet.

Aloception is a set of package for computer vision: aloscene, alodataset, alonet.

Visual Behavior 86 Dec 28, 2022
Train custom VR face tracking parameters

Pal Buddy Guy: The anipal's best friend This is a small script to improve upon the tracking capabilities of the Vive Pro Eye and facial tracker. You c

7 Dec 12, 2021
Pure Javascript OCR for more than 100 Languages 📖🎉🖥

Version 2 is now available and under development in the master branch, read a story about v2: Why I refactor tesseract.js v2? Check the support/1.x br

Project Naptha 29.2k Jan 05, 2023
Binarize document images

Binarization Binarization for document images Examples Introduction This tool performs document image binarization (i.e. transform colour/grayscale to

QURATOR-SPK 48 Jan 02, 2023
aardio的opencv库

opencv_aardio dll库下载地址:https://github.com/xuncv/opencv-plugin/releases import cv2 img = cv2.imread("./images/Lena.jpg",1) img = cv2.medianBlur(img,5)

71 Dec 31, 2022
make a better chinese character recognition OCR than tesseract

deep ocr See README_en.md for English installation documentation. 只在ubuntu下面测试通过,需要virtualenv安装,安装路径可自行调整: git clone https://github.com/JinpengLI/deep

Jinpeng 1.5k Dec 28, 2022
Drowsiness Detection and Alert System

A countless number of people drive on the highway day and night. Taxi drivers, bus drivers, truck drivers, and people traveling long-distance suffer from lack of sleep.

Astitva Veer Garg 4 Aug 01, 2022
Autonomous Driving project for Euro Truck Simulator 2

hope-autonomous-driving Autonomous Driving project for Euro Truck Simulator 2 Video: How is it working ? In this video, the program processes the imag

Umut Görkem Kocabaş 36 Nov 06, 2022
Use Convolutional Recurrent Neural Network to recognize the Handwritten line text image without pre segmentation into words or characters. Use CTC loss Function to train.

Handwritten Line Text Recognition using Deep Learning with Tensorflow Description Use Convolutional Recurrent Neural Network to recognize the Handwrit

sushant097 224 Jan 07, 2023