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

A program that takes in the hand gesture displayed by the user and translates ASL.

Interactive-ASL-Recognition Using the framework mediapipe made by google, OpenCV library and through self teaching, I was able to create a program tha

Riddhi Bajaj 3 Nov 22, 2021
scantailor - Scan Tailor is an interactive post-processing tool for scanned pages.

Scan Tailor - scantailor.org This project is no longer maintained, and has not been maintained for a while. About Scan Tailor is an interactive post-p

1.5k Dec 28, 2022
A webcam-based 3x3x3 rubik's cube solver written in Python 3 and OpenCV.

Qbr Qbr, pronounced as Cuber, is a webcam-based 3x3x3 rubik's cube solver written in Python 3 and OpenCV. 🌈 Accurate color detection πŸ” Accurate 3x3x

Kim ι‡‘ε―ζ˜Ž 502 Dec 29, 2022
graph learning code for ogb

The final code for OGB Installation Requirements: ogb=1.3.1 torch=1.7.0 torch-geometric=1.7.0 torch-scatter=2.0.6 torch-sparse=0.6.9 Baseline models T

PierreHao 20 Nov 10, 2022
This is an API written in python that uses FastAPI. It is a simple API that can detect discord tokens in Images.

Welcome This is an API written in python that uses FastAPI. It is a simple API that can detect discord tokens in Images. Installation There are curren

8 Jul 29, 2022
A bot that extract text from images using the Tesseract OCR.

Text from image (OCR) @ocr_text_bot A simple bot to extract text from images. Usage What do I need? A AWS key configured locally, see here. NodeJS. I

Weverton Marques 4 Aug 06, 2021
Self-supervised Equivariant Attention Mechanism for Weakly Supervised Semantic Segmentation, CVPR 2020 (Oral)

SEAM The implementation of Self-supervised Equivariant Attention Mechanism for Weakly Supervised Semantic Segmentaion. You can also download the repos

Hibercraft 459 Dec 26, 2022
(CVPR 2021) Back-tracing Representative Points for Voting-based 3D Object Detection in Point Clouds

BRNet Introduction This is a release of the code of our paper Back-tracing Representative Points for Voting-based 3D Object Detection in Point Clouds,

86 Oct 05, 2022
An Implementation of the FOTS: Fast Oriented Text Spotting with a Unified Network

FOTS: Fast Oriented Text Spotting with a Unified Network Introduction This is a pytorch re-implementation of FOTS: Fast Oriented Text Spotting with a

GeorgeJoe 171 Aug 04, 2022
learn how to use Gesture Control to change the volume of a computer

Volume-Control-using-gesture In this project we are going to learn how to use Gesture Control to change the volume of a computer. We first look into h

Diwas Pandey 49 Sep 22, 2022
Histogram specification using openCV in python .

histogram specification using openCV in python . Have to input miu and sigma to draw gausssian distribution which will be used to map the input image . Example input can be miu = 128 sigma = 30

Tamzid hasan 6 Nov 17, 2021
Can We Find Neurons that Cause Unrealistic Images in Deep Generative Networks?

Can We Find Neurons that Cause Unrealistic Images in Deep Generative Networks? Artifact Detection/Correction - Offcial PyTorch Implementation This rep

CHOI HWAN IL 23 Dec 20, 2022
An interactive document scanner built in Python using OpenCV

The scanner takes a poorly scanned image, finds the corners of the document, applies the perspective transformation to get a top-down view of the document, sharpens the image, and applies an adaptive

Kushal Shingote 1 Feb 12, 2022
This can be use to convert text in a file to handwritten text.

TextToHandwriting This can be used to convert text to handwriting. Clone this project or download the code. Run TextToImage.py give the filename of th

Ashutosh Mahapatra 2 Feb 06, 2022
Detect textlines in document images

Textline Detection Detect textlines in document images Introduction This tool performs border, region and textline detection from document image data

QURATOR-SPK 70 Jun 30, 2022
PyNeuro is designed to connect NeuroSky's MindWave EEG device to Python and provide Callback functionality to provide data to your application in real time.

PyNeuro PyNeuro is designed to connect NeuroSky's MindWave EEG device to Python and provide Callback functionality to provide data to your application

Zach Wang 45 Dec 30, 2022
pyntcloud is a Python library for working with 3D point clouds.

pyntcloud is a Python library for working with 3D point clouds.

David de la Iglesia Castro 1.2k Jan 07, 2023
A simple demo program for using OpenCV on Android

Kivy OpenCV Demo A simple demo program for using OpenCV on Android Build with: buildozer android debug deploy run Run (on desktop) with: python main.p

Andrea Ranieri 13 Dec 29, 2022
Python package for handwriting and sketching in Jupyter cells

ipysketch A Python package for handwriting and sketching in Jupyter notebooks. Usage A movie is worth a thousand pictures is worth a million words...

Matthias Baer 16 Jan 05, 2023
The first open-source library that detects the font of a text in a image.

Typefont Typefont is an experimental library that detects the font of a text in a image. Usage Import the main function and invoke it like in the foll

Vasile PeΘ™te 1.6k Feb 24, 2022