Research - bounswe/bounswe2023group1 GitHub Wiki

Research

NumPy

prepared by Alperen Dağı

Introduction

The Python package NumPy is used for numerical computation, data analysis, and scientific computing. It offers functions for working with arrays and matrices as well as a robust N-dimensional array object.

Pros

  • NumPy offers a wide variety of mathematical functions.
  • NumPy arrays are particularly efficient.
  • NumPy works nicely with Python libraries for scientific computing.

Cons

  • NumPy has a steep learning curve for beginners.
  • NumPy's documentation might be challenging .
  • For particularly big datasets, NumPy arrays can be memory-intensive.

Example

import numpy as np
# Create a 2x3 array with random values
arr = np.random.rand(2, 3)

# Calculate the mean of the array
mean = np.mean(arr)

# Print the mean
print(mean)

Introduction

The Java package RxJava is a library for writing asynchronous and event-driven programs in Java. The library is built on "Observables" and "Observers" that allow users to emit, process, and subscribe to a flow of events or objects.

Pros

  • RxJava has extensive documentation, explaining all the classes and concepts in the library, using graphics as well as text. In many cases, visual documentation helps explain concepts better than the text.
  • The library offers a mix of simple and complex functionality and manages to hide away the complexity until the user requires it.
  • There is an emphasis on extendability and many other libraries, especially in the Android ecosystem, offer support for RxJava.

Cons

  • RxJava is not very intuitive, especially for programmers not used to event-driven functional programming. This makes it harder to write good RxJava code.
  • It is extremely hard to debug RxJava code, as most of the time, an event is processed by multiple threads at different points in its lifecycle. This means that you cannot follow an event end to end the way you can with imperative code.

Example

package rxjava.examples;

import io.reactivex.rxjava3.core.*;

public class HelloWorld {
    public static void main(String[] args) {
        Observable.just("Hello world").subscribe(System.out::println);
    }
}

mpi4py

prepared by Volkan Öztürk

Introduction

Mpi4py is a Python package for developing MPI programs with Python. (MIMD type parallel algorithms according to Flynn's Taxonomy.) It enables to exploit multiple processors to design and run programs with Python scripts.

Pros

  • It is easy to use. Mpi4py provides simple Python interface for MPI. So, for a developer, it is easy to design parallel algorithms with Python.
  • New communicators can be easily created with COMM_WORLD.
  • Blocking/Nonblocking and One/Two Sided communications are all supported by the package.

Cons

  • It requires a background on parallel algorithms topic to use mpi4py package comfortably.
  • Communications types are not very well explained in the documentation, could have been enhanced with some examples.
  • There is not any trivial debugging tool provided by the package.

Example


# Basic code with mpi4py. Every processor prints their own rank respectively.

from mpi4py import MPI

comm = MPI.COMM_WORLD # Communicator instance
world_size = comm.Get_size() # Number of processors
rank = comm.Get_rank() # Rank of the processor

print("Hello from rank:", rank)


TensorFlow

prepared by Furkan Bülbül

Introduction

Tensorflow is an open-source framework developed by Google to built Machine-Learning models. Initially, it was used as an internal tool at Google. After years now, it has been open-source and many people contribute the project.

Pros

  • Repository has a great documentation about how to contribute and open an issue.
  • Provides stable Python and C++ APIs, also encourages the community to develop and maintain for other languages.
  • Has many resources and courses that are useful to learn TensorFlow.

Cons

  • Repository has a great number of issues and pull requests, therefore tracking the community activity is challenging.
  • It does not guarantee backward compatible APIs other than Python and C++.

Google Maps Services API

prepared by Muhammet Ali Topcu

Introduction

In our Disaster Response Project, it is very likely that we will need to use maps. So, I decided to inspect Google Maps Services API and many other APIs, too.

Details

Google Maps API has many APIs such as Directions API which provides routes between places and Geocoding API that finds the location's latitude and longitude from given location string. To be able to use Google Maps Services API, we first need a Google Cloud account to get API key. With this key, it is possible that we can access Google Maps Web Services from our future server and clients. I followed the documentation from Google Maps to understand the working of some components such as Marker, Directions and how to call Maps Service API.

Also, to easily test the API, I created a react app and used @react-google-maps/api package that I installed from npm package manager. This repository & package is good to use Google Maps with React.js but its documentation is not much explanatory. Here is the link for that package: React Google Maps API

Example


Matplotlib

prepared by Çağrı Gülbeycan

Introduction

Matplotlib is one of the best Data Visualization libraries used in Python. Although it is a Python library, it can also be used in some other programming languages like R. It is an open-source library with more than 1200 contributors on March 2023.

Pros

  • Matplotlib offers a wide range of options for visualizing data such as scatter plots, bar plots, histograms, heatmaps, 3-D, and more.
  • It is easy to learn Matplotlib. Besides, there are many online resources on the web to learn how to use Matplotlib
  • It also has a good website to see more examples, tutorials, and additional functionalities of Matplotlib.

Cons

  • Generally, it is thought that using Matplotlib is not the ideal way of creating very complex plots. The main reason is that it requires more manual configurations compared to some other libraries such as Plotly.
  • Matplotlib would probably not be the best option for creating interactive (Interactivity allows users to interact with the visualizations by performing actions like zooming, panning, hovering, selecting, and updating data in real-time.) plots for one's project.

Example

Here is an example from the website of Matplotlib:

import matplotlib.pyplot as plt

fig, ax = plt.subplots()

fruits = ['apple', 'blueberry', 'cherry', 'orange']
counts = [40, 100, 30, 55]
bar_labels = ['red', 'blue', '_red', 'orange']
bar_colors = ['tab:red', 'tab:blue', 'tab:red', 'tab:orange']

ax.bar(fruits, counts, label=bar_labels, color=bar_colors)

ax.set_ylabel('fruit supply')
ax.set_title('Fruit supply by kind and color')
ax.legend(title='Fruit color')

plt.show()

FFmpeg

prepared by Cem Sarpkaya

Introduction

FFmpeg is a set of very sophisticated command-line tools for manipulating media files.

Pros

  • Easy to use. It can be used to cut a portion of a video, or apply a filter to it with just a single, short command.
  • Very fast and efficient.
  • Excellent documentation on their website. It is complete and easy to navigate, with the most frequent use cases seperated.

Cons

  • I don't really have much experience with it, but it seems to me complex manipulations require a great amount of knowledge about the tool itself, and are hard to do by hand.

Example

My favorite use case from the page https://ffmpeg.org/faq.html#How-do-I-encode-movie-to-single-pictures_003f:

ffmpeg -i movie.mpg movie%d.jpg

This command extracts (and encodes) every single frame from the file movie.mpg, and saves them in the same directory.


Python Telegram API

prepared by Harun Reşid Ergen

Introduction

The TelegramBot API is a Python package used for developing bots on the Telegram messaging platform. It offers a simple yet powerful interface for creating and managing bots, as well as interacting with users through messaging.

Pros

  • Easy-to-use interface: The TelegramBot API provides a straightforward interface for developers to create Telegram bots. It offers various methods for handling messages, including text, images, and audio, making it easy to develop a wide range of bot functionalities.
  • Support for various message types: The API supports various types of messages, including text, images, audio, and video, allowing developers to create bots with rich media content.
  • Continuously updated: The TelegramBot API is continuously updated with new features and improvements, ensuring that developers have access to the latest tools and functionality.
  • Large community: The TelegramBot API has a large and active community of developers, making it easy to find support and resources when needed.

Cons

  • Limited functionality: While the TelegramBot API offers a range of features for creating and managing bots, it might not be suitable for very complex bot functionalities. Developers might need to set up additional libraries or tools to handle more advanced features.
  • Dependence on third-party libraries: Developers might need to install and set up third-party libraries or tools to handle certain features, such as database management or natural language processing.
  • Potential downtime: The TelegramBot API might be subject to occasional downtime or technical issues, which can affect the reliability of bots built on the platform.

Example

'''When the /start command is given, this basic Telegram bot responds with the message 
"I'm a bot, please talk to me!" to greet the user and initiate the conversation.'''

import logging
from telegram import Update
from telegram.ext import ApplicationBuilder, ContextTypes, CommandHandler

logging.basicConfig(
    format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
    level=logging.INFO
)

async def start(update: Update, context: ContextTypes.DEFAULT_TYPE):
    await context.bot.send_message(chat_id=update.effective_chat.id, text="I'm a bot, please talk to me!")

if __name__ == '__main__':
    application = ApplicationBuilder().token('TOKEN').build()
    
    start_handler = CommandHandler('start', start)
    application.add_handler(start_handler)
    
    application.run_polling()

Terraform

prepared by Kübra Aksu

Introduction

Terraform is an open-source infrastructure as code tool that is widely used for managing cloud resources. It provides a declarative language for describing infrastructure, and a large collection of providers for different cloud platforms. Terraform enables teams to automate the provisioning and management of infrastructure, and to apply changes safely and efficiently.

Pros

  • Declarative syntax for describing infrastructure.
  • Supports multiple cloud platforms and services.
  • Provides a consistent and repeatable way to manage infrastructure.
  • Allows for version control and collaboration on infrastructure code.
  • Provides a testing framework for infrastructure changes.

Cons

  • Steep learning curve for beginners.
  • Requires a deep understanding of cloud infrastructure and services.
  • May not support all features of a cloud platform or service.
  • Requires careful planning and testing for complex infrastructures.
  • May require additional tools or plugins for certain use cases.

Example

provider "aws" {
	access_key = "ACCESS_KEY"
	secret_key = "SECRET_KEY"
	region     = "us-west-2"
		}

resource "aws_instance" "example" {
	ami           = "ami-0c55b159cbfafe1f0"
	instance_type = "t2.micro"
	key_name      = "example_key"
                }

Usage

Here is an example of Terraform being used to manage AWS infrastructure: src="https://developer.hashicorp.com/terraform/tutorials/aws-get-started/aws-build"

Socially Advantages

  • Enables teams to collaborate on infrastructure code
  • Allows for version control and rollback of infrastructure changes
  • Encourages a consistent and repeatable approach to infrastructure management
  • Facilitates testing and automation of infrastructure changes
  • Improves security and compliance by reducing manual configuration and drift

Conclusion

Terraform is a powerful infrastructure as code tool that provides a consistent and repeatable approach to managing cloud resources. While it does have a steep learning curve and may require careful planning and testing, Terraform enables teams to automate the provisioning and management of infrastructure, and to apply changes safely and efficiently. Its social advantages include collaboration, version control, consistency, testing, and improved security and compliance.


OpenCV

prepared by Sezer Çot

Introduction

The OpenCV repository on GitHub is a popular resource for computer vision researchers and practitioners, containing open-source computer vision algorithms and libraries that support various functions such as image and video processing, feature detection, and machine learning. Its versatility in supporting multiple programming languages, active development community, and wide range of applications make it a comprehensive resource for developers in different industries. The repository also contains documentation, tutorials, and examples, making it easy for users to learn and use the library.

Pros

  • OpenCV is an open-source computer vision library with a vast collection of algorithms that support image and video processing, feature detection, object detection and tracking, machine learning, and more.
  • It has a large community of developers who actively contribute to its development, which ensures that it is regularly updated and improved.
  • The library has a wide range of applications, including robotics, surveillance, augmented reality, and medical imaging, making it useful for many different industries.
  • OpenCV provides support for multiple programming languages, including C++, Python, and Java, making it accessible to developers with different language preferences.
  • The repository contains comprehensive documentation, including tutorials and examples, which makes it easy for users to learn and use the library.

Cons

  • OpenCV has a steep learning curve, and its advanced features may be challenging for beginners to use.
  • The library can be memory-intensive, which can impact performance, especially when processing large data sets.
  • While OpenCV has many functions, it may not always have the most optimal algorithm for a specific task, requiring users to implement custom algorithms.
  • The library does not provide built-in support for deep learning, which is an area of computer vision that has gained popularity in recent years.

Example

Here's an example Python method from the OpenCV repository on GitHub:


import cv2

def load_image(image_path):
    """
    Load an image from a file path and return a NumPy array representation of the image.
    """
    # Read the image file
    img = cv2.imread(image_path)

    # Convert the image from BGR to RGB format
    img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)

    return img

This method, load_image, uses the cv2 module to load an image file from a given file path and convert it into a NumPy array representation in RGB format. This method can be useful when working with image processing tasks in Python, such as analyzing or manipulating images with OpenCV.

Usages

Here are some links to OpenCV resources that can help you explore the different ways in which the library can be used:

  1. Computer Vision Research: OpenCV has a dedicated page on its website for research, which includes information on computer vision research projects that use OpenCV, as well as links to relevant papers and publications. You can find the page here: https://opencv.org/research/.

  2. Image and Video Processing: The OpenCV documentation provides extensive information on image and video processing, including tutorials, examples, and API documentation. You can find the documentation here: https://docs.opencv.org/.

  3. Robotics: OpenCV has a dedicated page on its website for robotics, which includes information on robotics projects that use OpenCV, as well as links to relevant papers and publications. You can find the page here: https://opencv.org/robotics/.

  4. Augmented Reality: OpenCV has a dedicated page on its website for augmented reality, which includes information on augmented reality projects that use OpenCV, as well as links to relevant papers and publications. You can find the page here: https://opencv.org/augmented-reality/.

  5. Medical Imaging: OpenCV has a dedicated page on its website for medical imaging, which includes information on medical imaging projects that use OpenCV, as well as links to relevant papers and publications. You can find the page here: https://opencv.org/medical-imaging/.

Socially Advantages

The OpenCV repository on GitHub has several social advantages that contribute to its popularity and success:

  1. Accessibility: OpenCV is an open-source library that is freely available to anyone who wants to use it. This makes it accessible to developers and researchers who may not have access to expensive proprietary software. The library also supports multiple programming languages, making it accessible to developers with different language preferences.

  2. Community: OpenCV has a large and active community of contributors who are constantly working to improve and update the library. This community includes developers, researchers, and users who collaborate on projects, share knowledge and best practices, and provide support to one another.

  3. Education: OpenCV provides extensive documentation, tutorials, and examples that make it easy for users to learn and use the library. This has contributed to its popularity in academic and educational settings, where it is often used to teach computer vision concepts and techniques.

  4. Innovation: OpenCV is a powerful library that provides developers with a comprehensive set of tools to work with images and videos. This has led to innovative and creative applications of computer vision technology in various industries, including robotics, surveillance, augmented reality, and medical imaging.

  5. Impact: OpenCV has had a significant impact on the field of computer vision, with many researchers and practitioners using the library in their work. This impact has contributed to the growth and development of the field and has helped to make computer vision technology more accessible and widely used.

Conclusion

Overall, the OpenCV repository on GitHub is a valuable resource for computer vision developers, offering a comprehensive collection of algorithms and support for multiple programming languages. However, its steep learning curve and memory requirements may present challenges for beginners and those working with large data sets. Additionally, it may not always have the most optimal algorithm for a specific task, and it does not provide built-in support for deep learning, which may require additional development effort.