teleren/devto huggingface dataset:
Introducing aipose 1/X: A Python Library for Pose Estimation
Tags: python, computervision, deeplearning, poseestimation
Published: 2023-03-12 22:38:41


![aipose logo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kwngwf9lyz6eesysmwuv.png)

If you're working with computer vision or machine learning projects, you may have come across the need for pose estimation. This is the process of detecting and tracking the position and orientation of objects in an image or video. Fortunately, there are many open-source libraries available to help with this task, and today I want to introduce you to aipose.

One of the primary advantages of using aipose is its ease of use. With just a few lines of code, you can load an image or video and use the library to detect and track human bodies. aipose provides pre-trained models for detecting body keypoints and estimating their poses, so you don't have to spend time training your own modelsor researching projects without documentation or one file with a lot of hundreds on code lines.

With just a few lines of code, you can load an image or video and use the library to detect and track human bodies. 

Here's an example of how to use aipose to detect and track a person in an image:

```python
import cv2
import numpy as np
from numpy import ndarray
from typing import List

from aipose.models.yolov7.domain import YoloV7Pose, YoloV7PoseKeypoints
from aipose.plot import plot


# Load image
image: ndarray = cv2.imread("person.jpg")
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)

# Create pose estimator
model = YoloV7Pose()

# Detect and track body
prediction = model(image)

# Draw keypoints and skeleton
plot(image, np.array([value.raw_keypoint for value in prediction]))

```

![aipose prediction plot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l5taij7sbrdijxox4t1c.png)


In this example, we first load an image using the OpenCV library. Then, we create a PoseEstimator object from aipose and use it to detect and track the body in the image. Finally, we draw the detected keypoints and skeleton onto the image and display it.

aipose also provides functions for working with videos and webcams, as well as for saving the detected poses to a CSV file for further analysis.

Overall, aipose is a powerful and easy-to-use library for pose estimation in Python. Whether you're working on a computer vision or machine learning project, or just want to experiment with pose estimation, I highly recommend giving aipose a try.

To get started, you can install aipose using pip:

```bash
pip install aipose
```

You can also find the source code and documentation on GitHub:

https://github.com/Tlaloc-Es/aipose

I hope this introduction to aipose has been helpful. If you have any questions or feedback, feel free to leave a comment below!

Notebook with the example: https://github.com/Tlaloc-Es/aipose/blob/master/notebooks/plot_keypoints.ipynb
Random numbers
Tags: miniscript, minimicro, tutorial, random
Published: 2023-03-12 22:26:45

In this blogpost we are going to take a look on how to produce random numbers within a certain range in MiniScript / Mini Micro.

![Printing random numbers in Mini Micro](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oxqv8j156pr6hie7r9rq.png)

## The `rnd` function

In MiniScript (and by extension Mini Micro) the way to get random numbers is by using the [`rnd`](https://miniscript.org/wiki/Rnd) intrinsic function.

Calling this function gives you a floating-point random number between 0 and 1.

```
> print rnd
0.147535
> print rnd
0.421682
```

## Bigger range

If we want a bigger range of random numbers all we have to do is multiply the result of `rnd` by some other number. For example: if we want random numbers between 0 and 20 we evaluate `rnd * 20`:

```
> print rnd * 20
15.439491
> print rnd * 20
19.455438
> print rnd * 20
8.460014
```

## The `floor` function

Often we need random integers (whole numbers). One way to convert a floating-point number to an integer is by calling another intrinsic function: [`floor`](https://miniscript.org/wiki/Floor). Applying this function to a floating-point number will effectively strip it from the decimal digits, leaving only the "integer" part.

```
> print floor(0.14)
0
> print floor(42.9)
42
```

## Situation so far

Combining these three things:

1. ... calling `rnd` for random numbers between 0 and 1
2. ... multiplying `rnd` by a factor
3. ... applying `floor` to the result

... will produce random integers between 0 and the desired factor.

For example:

```
> print floor(rnd * 20)
13
> print floor(rnd * 20)
6
```

## Numbers in any range

What if we wanted to have random numbers for a certain range starting above 0?

what we need to do is to sum some fixed number to the result. When doing so we are "shifting" the range of results, so we need to be careful about the end of the range, which is also shifted. We usually need to compensate for that by subtracting from the factor, which corrects the range-size.

For example, let's say we want random numbers between 100 and 300.

What is the solution?

Maybe `floor(rnd * 300)`? No, this would give us numbers from 0 to 300.

Maybe `100 + floor(rnd * 300)`? No. Because `floor(rnd * 300)` gives us numbers from 0 to 300, adding 100 to it would give us numbers from 100 to _400_ (not what we want).Remember: the end-range is also shifted.

Because the end-range is shifted, we need to compensate by subtracting from the factor (to correct the range size).

The correct answer is general terms:

```
RANGE_SIZE = END_RANGE - START_RANGE
START_RANGE + floor(rnd * RANGE_SIZE)
```

And in our case:

```
100 + floor(rnd * (300-100))
```

Or, simplified:

```
100 + floor(rnd * (200))
```

Some examples:

```
> print 100 + floor(rnd * 200)
282
> print 100 + floor(rnd * 200)
102
> print 100 + floor(rnd * 200)
183
```

## Summary

With this we learnt how to generate random whole-numbers (integers) in a range between two arbitrary numbers in Mini Script.

In a future posts we will put this knowledge to use and have some fun with it.

Happy coding!
SVGR for your React app
Tags: react, webdev, svgr, javascript
Published: 2023-03-12 22:06:48

Most of the time, developers tend to add svg images to an assets directory and import them either directly or as a React component. This process not only increases your app bundle size but also makes managing all the assets difficult.
What if there was a way to manage all the application icons like the way we import them from any other icon library?
Yes, [react-svgr](https://react-svgr.com/) helps you manage all the icons in your React application.

## What is SVGR?
SVGR is an universal tool to transform SVG into React components.
SVGR takes a raw SVG and transforms it into a ready-to-use React component.

Example,
Raw svg icon,
![Raw svg icon](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ht5omtephjpl1zju8r3s.png)
After running SVGR, we get the below react component,
![SVGR react component](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8jpu3tup6tgbbrwjw9ez.png)

## How to use SVGR?

1. SVGR playground
[SVGR playground](https://react-svgr.com/playground/) will help us transform our svg image into a react component online. Then we can copy-paste this component into our react application for further use.
![SVGR Playground](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qnf3ha8go1kvnfvgxp7o.png)
 
2. SVGR cli
SVGR playground is useful only if we have few icons for transformation. But with [SVGR cli](https://react-svgr.com/docs/cli/) we can transform a single file or a whole directory.
can install `@svgr/cli` locally in our project:

```
npm install --save-dev @svgr/cli
# or use yarn
yarn add --dev @svgr/cli
```

- Transforms a single file by specifying file as the single argument.

```
npx @svgr/cli -- assets/icons/menu-icon.svg
```

- Transform a whole directory
Transforms a whole directory using `--out-dir` option. All SVG presents in this directory tree are transformed into React components.

```
npx @svgr/cli --out-dir dist -- icons
```

## Write a script for batch transformation
With the help of `@svgr/cli` we can simple write a script which can further simply this process.

1. Write new script into `package.json`,
![svgr cli script](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sh5xpjpx12vxe0aiafod.png)
2. Create `svgr.config.js` file on root lever with below config,
![svgr config](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/btl0ag1p7412l3ynu2qe.png)
3. Now we are good to execute below npm command to transform all our svg icons into react components.

```
npm run icon:create
```


### And more...
- Check [Hybrowlabs](https://hybrowlabs.com/react-js-dev-outsourcing) for React app development services.
OSD700: Working with BullMQ Worker/Queues (cont'd)
Tags: opensource, beginners, typescript, programming
Published: 2023-03-12 21:52:30

This week, I upgraded the notification system in [Starchart](https://github.com/DevelopingSpace/starchart) by implementing background jobs that repeat every 5 mins to query the database for existing DNS records or Certificates expiring in less than a month. If the query returns any data, we check the last time we notified the user. If we have never notified the user, we will send an initial reminder encouraging the user to log in to the system and renew the expiring records.

I am confident that initial reminders will be rolled out. Still, we would need to update the value of `lastNotified` when we renew expiring DNS records and Certificates so that users can be reminded again. I need to update the code so we can send a second reminder when records are about to expire in less than a week. 

Implementing background jobs to roll our notifications in this [PR](https://github.com/DevelopingSpace/starchart/pull/268) has been one of my most meaningful contributions to the project. It needs improvement, and I intend to perfect it so that any code that builds on top of it does not fail.
Docusaurus: Create your project documentation simply and efficiently!
Tags: programming, tutorial, beginners, productivity
Published: 2023-03-12 21:48:08

Hello,

Have you already arrived with a disorganized project or not having much time to create a documentation for it, we have Docusaurus is an opensource project powered by Meta that provides a set of tools and documentation site templates to help developers create high-quality, easy-to-use documentation sites for their projects.

To know more:

https://jlgjosue.medium.com/docusaurus-create-your-project-documentation-simply-and-efficiently-65ac65461849

Thanks for reading, share this post, please! :)
FREE AWS Cloud Project Bootcamp Week 3 Part 4
Tags: aws, cloud, awscommunity, 100daysofcloud
Published: 2023-03-12 21:39:48

[71/100] #100DaysOfCloud Today, I completed the Week 3 of the FREE AWS Cloud Project Bootcamp by Andrew Brown.

The rest of Week 3 was to debug and solve the error and tweak the CSS to make the UI better. I had asked the bootcampers on the AWS Virtual User Group Discord channel for help and happened to debug and solve the problem. It was a mistake in the variable name. It was  AWS_COGNITO_USERPOOL_ID in my app.py file and AWS_COGNITO_USER_POOL_ID in my docker compose file and that caused the issue. Then I made some tweaks to the CSS to make the UI better.

Checkout what I did for Week 3 : [GitHub repo](Checkout what I did for Week 2: [GitHub](https://github.com/aaditunni/100DaysOfCloud/blob/main/Journey/071/Readme.md)

You can watch the Bootcamp through this YouTube playlist : [FREE AWS Cloud Project Bootcamp playlist](https://youtube.com/playlist?list=PLBfufR7vyJJ7k25byhRXJldB5AiwgNnWv)
ChatGPT is a regex god
Tags: chatgpt, regex, webdev
Published: 2023-03-12 21:36:31


ChatGPT can give you statements that either:
1. Sounds very truthful, but has something wrong with it
2. Is surprisingly good and accurate 

With Regex questions, it seems to weigh way more on the latter.

![image](https://i.ibb.co/vwq3Lkv/image.png)

A few examples:

1. Match a Reddit post URL
![Reddit post url ChatGPT response](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/73r41qt8csrjfxj2n3sa.png)

2. Match a Twitter reply 
![Twitter reply ChatGPT response](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rnqhu51buiwmpa2bdctn.png)



3. Match a document format from a country
![ChatGPT response](https://i.ibb.co/VQmK4pg/image.png)

4. Match any email address that ends with "gmail.com" and contains a plus  sign (+) followed by any combination of alphanumeric characters before  the @ symbol
![ChatGPT response](https://i.ibb.co/mHyX7ZN/image.png)


5. Match any phone number in the format (XXX) XXX-XXXX where the first three digits cannot be 555
![ChatGPT response](https://i.ibb.co/7G88n7x/image.png)


> Be careful, it's prone to mistakes, so it's always a good idea to test it on an app like https://regex101.com/

Overall, I feel like most of the generated regular expressions are already going to be good enough to save some valuable minutes of your life.
Day 2 of 100 Days of Python code: Why use Python
Tags: 100daysofcode, python
Published: 2023-03-12 21:31:05

Today I learnt about what type of projects we can do with the help of python programming language such as making a virtual assistant, building your own GUI based game, and some fun project which will calculate the love percentage between you and your partner. In the future, it would be great to learn more about this. This was all about acquiring theoretical knowledge.
Managing Rights in Linux
Published: 2023-03-12 21:20:42

Linux is a multi-user system so it is necessary to provide a permissions system to control the set of authorized operations on files and directories, which includes all the system resources and devices (on a Unix system, any device is represented by a file or directory). This principle is common to all Unix-like systems.

Each file or directory has specific permissions for three categories of users:

The owner (represented with u as in user)
The group (represented with g as in group)
The others (represented with o as in others)
Three types of rights can be combined:

**Read** (symbolized with r)
**Write** (symbolized with w) and
**Execute** (symbolized by x)
The commonest way to allow rights and permissions on files and folders is to use **chmod, chown and chgrp**.

Eg. To allow a read right on a folder or file for a user/owner, **chmod u+r path/to/file_or_folder**
To allow all rights i.e read, write and execute for a user/owner, **chmod u+rwx path/to/file_or_folder**
Do you also know that we can use figures as in numbers to represent those rights and user categories? Let's dive into it. I'm pretty sure most of us have seen some of these commands before:

- **chmod 700 hello.py, chmod 754 hello_world.sh, or chmod 777 /etc/kubernetes** however, we do not understand the figures.
This is what they mean. Remember the three rights stated earlier, this is what they are referred to in numerical terms. 4 - read, 2 - write and 1 - execute and each of the commands above (chmod '700') also represent *7-user, 0-group and 0-others* in that order.
Now, that is not the end of it. Each figure (700) = **chmod 7=4+2+1 0=0+0+0 0=0+0+0** which all represent the read, write and execute permissions for each user on a file or directory.

Eg. **chmod 754 hello.py** means a user/owner can **4-read, 2-write and 1-execute the hello.py file, and the group users can 4-read and 1-execute the hello.py file, but the other users can only 4-read that file**.

So just do the math whenever you want to use **chmod 777** on any important file.
Setting Up Postgres Server on Ubuntu
Published: 2023-03-08 10:16:48

## Installing Postgres

 - Update and Upgrade the server
 - `sudo apt install wget ca-certificates` to install wget and ca-certificates
 - Get the certificate and add it to apt-key management
   - `wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -`
   - `sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'`
   - Throw and Error:
   	-> install this missing dependency : `apt install gnupg`
 - Update the server : `sudo apt update`
 - Install Postgres : `apt install postgresql postgresql-contrib`
 - Check Postgres : `service postgresql status`

## Setting Up Postgres Server

 - Enable connection from the client
   `nano /etc/postgresql/14/main/postgresql.conf`
   - Uncomment and replace ip_address with `*` : 
     `listen_addresses = '*'`
 - Edit the PostgreSQL access policy
   `nano /etc/postgresql/14/main/pg_hba.conf`
   - Append the following line : `host all all 0.0.0.0/0 md5`
 - Restart the Server `systemctl restart postgresql`

## Creating a new User and Database
 - Creating a new user
   `sudo -u postgres createuser <username>`
 - Creaing a new databse
   `sudo -u postgres createdb <dbname>`
 - Change Password and grant privileges on database
    `sudo -u postgres psql`
    `alter user <username> password '<password>';`
    `grant all privileges on database <dbname> to <username> ;`

## Check the Connection using
 - `psql -h <ip_address> -p 5432 -d <database> -U <username>`
Day 1 of 100 Days of Python code: Intro to python
Tags: 100daysofcode, python, beginners, programming
Published: 2023-03-12 21:13:24

****Day 1**** 

I acquired knowledge of the person who invented the python programming language his name was **"Guido Van Rossum"** in the year 1991/1989. He entitled this name **"Python" **after watching a show at that time named **"Python Circus"**. I also came to know about what is programming, various features of python programming language such as:

1. Dynamically Typed
2. General Purpose Programming language 
3. Supports Object Oriented Programming
4. Interpreted 
5. Platform Independent
6. Open-Source Programming language
7. Provides big library support
Why () -> {throw e} is more Supplier than Runnable
Published: 2023-03-12 21:00:00

Recently, while writing test, I encountered enexpected (for myself) Java behaviour. In simplified form, the situation was as in the code below. I expected that the `testRunnable` would invoke `run(Runnable)` method, but instead `run(Supplier)` was invoked. 

```java
public void testRunnable() {
	run(() -> {
		throw new RuntimeException();
	});
}

public void run(Supplier<?> supplier) {
	supplier.get();
}

public void run(Runnable runnable) {
	runnable.run();
}
```

But it is not a bug, `run(Supplier)` was chosen because it has **more specific signature**. There is method for this - `com.sun.tools.javac.comp.Resolve#signatureMoreSpecific`. In simplified form it looks like code below. 

```java
boolean signatureMoreSpecific(Method m1, Method m2) {
  var methodInstance = instantiate(m2, m1.args)
  return methodInstance != null;
}
```

How this method works will be clearer with more obvious example. Let’s say we have method `print(String)` and `print(Object)`. Then we try to instantiate `print(Object)` with `String` argument. Obviously it will be instantiated successfully. Then we try instantiate `print(String)` with `Object` argument. It will fail, because we can’t pass `Object` in method which consume `String`. 

```java
signatureMoreSpecific("print(String)", "print(Object)") 
	-> instantiate("print(Object)", "String") 
	-> success
	->  true

signatureMoreSpecific("print(Object)", "print(String)") 
	-> instantiate("print(String)", "Object") 
	-> fail
	->  false
```

So method signature is more specific if it can be passed into other method and signature of this method can’t be passed into first method.

```java
Method mostSpecific(Method m1, Method m2) {
  boolean m1SignatureMoreSpecific = signatureMoreSpecific(m1, m2);  
  boolean m2SignatureMoreSpecfic = signatureMoreSpecific(m2, m1);
  if (m1SignatureMoreSpecific && m2SignatureMoreSpecific) {
    // …
  } 
  else if (m1SignatureMoreSpecific) return m1;
  else if (m2SignatureMoreSpecific) return m2;
  else throw e;
}
```
Como a inteligência artificial está mudando o cenário tecnológico.
Tags: news, ai, linux, startup
Published: 2023-03-12 20:57:41

Como a inteligência artificial está mudando o cenário tecnológico

A inteligência artificial (IA) é uma das tecnologias mais revolucionárias do século XXI, e sua capacidade de automatizar tarefas e fornecer insights valiosos está transformando a maneira como vivemos e trabalhamos. Com o avanço da tecnologia, a IA está se tornando mais acessível e poderosa, permitindo que as empresas obtenham insights de dados em tempo real, automatizem processos manuais e criem experiências personalizadas para os clientes.

Aqui estão algumas maneiras pelas quais a IA está mudando o cenário tecnológico:

Automação de processos
A IA está permitindo que as empresas automatizem processos manuais, como a entrada de dados, a classificação de documentos e a triagem de e-mails. Isso economiza tempo e reduz erros, permitindo que os funcionários se concentrem em tarefas mais importantes e criativas. A IA também pode ser usada para monitorar e otimizar processos, identificando gargalos e sugerindo melhorias.

Análise de dados
A IA está transformando a maneira como as empresas analisam dados, permitindo que elas obtenham insights mais profundos e precisos em tempo real. A IA pode ser usada para analisar grandes conjuntos de dados, identificar tendências e padrões, e prever resultados futuros. Isso permite que as empresas tomem decisões mais informadas e estratégicas.

Assistência virtual
A IA está permitindo que as empresas criem assistentes virtuais inteligentes que podem ajudar os clientes a encontrar o que estão procurando e responder a perguntas comuns. Esses assistentes virtuais podem ser integrados em sites, aplicativos e plataformas de mídia social, proporcionando uma experiência mais personalizada e conveniente para os clientes.

Reconhecimento de voz e imagem
A IA está melhorando o reconhecimento de voz e imagem, permitindo que as empresas criem soluções mais eficazes para problemas de reconhecimento de fala e imagem. Isso inclui chatbots que podem reconhecer e responder a comandos de voz, e software que pode identificar objetos e pessoas em imagens.

Personalização
A IA está permitindo que as empresas criem experiências personalizadas para os clientes, com base em suas preferências e histórico de compras. Isso inclui recomendações de produtos personalizadas, conteúdo personalizado e ofertas personalizadas. Isso ajuda as empresas a aumentar a satisfação do cliente e a fidelidade à marca.

Conclusão

A IA está transformando o cenário tecnológico, permitindo que as empresas automatizem processos, analisem dados em tempo real, criem assistentes virtuais inteligentes, melhorem o reconhecimento de voz e imagem e personalizem a experiência do cliente. Com o avanço da tecnologia, a IA está se tornando mais acessível e poderosa, permitindo que as empresas obtenham insights de dados em tempo real, automatizem processos manuais e criem experiências personalizadas para os clientes.