Skip to content

Commit

Permalink
Fix issue with video window
Browse files Browse the repository at this point in the history
  • Loading branch information
jrrodri committed Sep 20, 2024
1 parent c7f8abf commit 855e4bc
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 14 deletions.
14 changes: 5 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Abraia Python SDK image analysis toolbox

The Abraia Python SDK provides and easy and practical way to develop and deploy Machine Learning image applications on the edge. You can easily annotate and train your custom deep learning model with [DeepLab](https://abraia.me/deeplab), and deploy the model with this Python SDK.
The Abraia Python SDK provides and easy and practical way to develop and deploy Machine Learning image applications on the edge. You can easily annotate and train your custom deep learning model with [DeepLab](https://abraia.me/deeplab/), and deploy the model with this Python SDK.

![people walking](https://github.com/abraia/abraia-multiple/raw/master/images/people-walking.gif)

Expand Down Expand Up @@ -39,9 +39,7 @@ You can easily train your custom models from [DeepLab](https://abraia.me/deeplab
```python
from abraia import detect

dataset = 'camera'
model_name = 'yolov8n'
model_uri = f"https://api.abraia.me/files/multiple/{dataset}/{model_name}.onnx"
model_uri = f"https://api.abraia.me/files/multiple/camera/yolov8n.onnx"

model = detect.load_model(model_uri)

Expand All @@ -61,15 +59,13 @@ from PIL import Image
from abraia import detect


dataset = 'camera'
model_name = 'yolov8n'
model_uri = f"https://api.abraia.me/files/multiple/{dataset}/{model_name}.onnx"
model_uri = f"https://api.abraia.me/files/multiple/camera/yolov8n.onnx"

model = detect.load_model(model_uri)

video = detect.Video('people-walking.mp4')
for frame in video:
img = Image.fromarray(frame)
im = Image.fromarray(frame)
results = model.run(im, confidence=0.5, iou_threshold=0.5)
im = detect.render_results(im, results)
frame = np.array(im)
Expand Down Expand Up @@ -213,7 +209,7 @@ multiple.save_image('test.hdr', img, metadata=meta)

### Upload and load HSI data

To start with, we may [upload some data](https://abraia.me/console/gallery) directly using the graphical interface, or using the multiple api:
To start with, we may [upload some data](https://abraia.me/deeplab/) directly using the graphical interface, or using the multiple api:

```python
multiple.upload_file('PaviaU.mat')
Expand Down
2 changes: 1 addition & 1 deletion abraia/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from PIL import Image, ImageDraw, ImageFont

from video import Video
from .video import Video


tempdir = tempfile.gettempdir()
Expand Down
3 changes: 2 additions & 1 deletion abraia/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def __init__(self, src, output=None):
print(self.width, self.height, self.fps)
if output:
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
self.out = cv2.VideoWriter('output.mp4', fourcc, self.fps, (self.width, self.height))
self.out = cv2.VideoWriter(output, fourcc, self.fps, (self.width, self.height))

def __iter__(self):
while self.cap.isOpened():
Expand All @@ -26,6 +26,7 @@ def __iter__(self):
self.out.release()
if self.win_name:
cv2.destroyWindow(self.win_name)
cv2.waitKey(1)

def write(self, frame):
self.out.write(cv2.cvtColor(frame, cv2.COLOR_RGB2BGR))
Expand Down
4 changes: 2 additions & 2 deletions scripts/abraia
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def input_files(src):


@click.group('abraia')
@click.version_option('0.15.1')
@click.version_option('0.15.2')
def cli():
"""Abraia CLI tool"""
pass
Expand All @@ -64,7 +64,7 @@ def configure():
@cli.command()
def info():
"""Show user account information"""
click.echo('abraia, version 0.15.1\n')
click.echo('abraia, version 0.15.2\n')
click.echo('Go to [' + click.style('https://abraia.me/console/', fg='green') + '] to see your account information\n')


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

setup(
name='abraia',
version='0.15.1',
version='0.15.2',
description='Abraia Python SDK',
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down

0 comments on commit 855e4bc

Please sign in to comment.