AugeLab Studio Manual
English
English
  • 👋Welcome to AugeLab Studio User Manual
  • 📘Introduction
    • AugeLab Studio
    • Key Features
    • Use Cases
    • System Requirements
  • 🚀Getting Started
    • Signing up
    • Installation
    • First Look
    • Simple Tour
    • Your Very First Project
      • Basics
      • Detection
      • Wrapping Up
    • More Local Examples
    • Further Reading
  • 🖥️AugeLab Studio Interface
    • Detailed Look
    • Scenario Area
    • Menu and Toolbar
    • Managing Projects
    • Installing AI and much more
      • Leverage AI with Module Downloader
  • 🧱Function Blocks
    • Block Structures
    • Sockets
    • Blocks Column
    • Connections
    • All Function Blocks
      • AI Blocks
        • Face Detection
        • Mask Detection
        • Object Detection - Custom
        • Object Detection
        • Pose Estimation
        • Safety Equipment Detection
        • Social Distance Detector
        • Super Resolution
        • Text Detection
        • OCR
      • CNN Blocks
        • Average Pooling 2D
        • Batch Normalization
        • Choose Folder 2D
        • Compile Model
        • Conv. Sep. Layer 2D
        • Conv. Trans. Layer 2D
        • Convolutional Layer 2D
        • Dropout Layer
        • Flatten Layer 2D
        • Fully Connected
        • Global Average Pooling 2D
        • Global Max Pooling 2D
        • Input Layer 2D
        • Loss CCE
        • Max Pooling 2D
        • Metrics Accuracy
        • Model EfficientNet
        • Model MobileNet
        • Model ResNet
        • Model VGG
        • Optimizer Adadelta
        • Optimizer Adagrad
        • Optimizer Adam
        • Optimizer Adamax
        • Optimizer FTRL
        • Optimizer Nadam
        • Optimizer RMSProp
        • Optimizer SGD
        • ReLU Layer
        • Softmax Layer
        • Training Parameters
      • Data/Logic
        • Flow Control
          • Batch Concatenation
          • Batch Processing
          • Debatch
          • Get Batch Size
          • HMI Background
          • Subsystem Enabled
          • Subsystem In
          • Subsystem Loop
          • Subsystem Out
          • Subsystem
        • logic
          • All True
          • And
          • Demux
          • Equals
          • Greater
          • Logic Operations
          • Mux
          • Not
          • Or
          • Set - Reset
          • Smaller
        • Mathmetical Operations
          • Add
          • Counter
          • Divide
          • Math Operations
          • Maximum
          • Minimum
          • Multiply
          • Not Equals
          • Round
          • Square Root
          • Subtract
          • Trigonometry
        • Data Operations
          • Data Memory
          • Data to JSON
          • Data Type Converter
          • Datetime Compare
          • Dictionary Operations
          • Exclude Nones
          • Find Substring
          • Get Element
          • Is None
          • List Operations
          • Parse Data Dictionary
          • Replace None
          • String Merge
          • String Operations
        • Referencing
          • Data Read Global
          • Data Read Local
          • Data Write Global
          • Data Write Local
          • Debug Input
          • Tag From
          • Tag To
        • Signal Operators
          • Delay Step
          • Edge Falling
          • Edge Rising
          • Multi Port Switch
          • OFF Delay
          • ON Delay
      • Image/Transformations
        • Analysis
          • Color Density Percentage
          • Get Dimension
          • Histogram On Curve
          • Histogram On Line
          • Image Color Match
          • Image Memory
          • Image Resolution and Channel Value
          • Maximum Images
          • Mean Value of Image
          • Measure Position Distance
          • Minimum Images
          • Non-zero of Image
          • Std. of Image
          • Structural Similarity
        • Transformation Filters
          • Auto Alignment
          • Auto Contrast
          • Color Quantizer and Clustering
          • Color Space
          • Contrast-Brightness-Gamma
          • Contrast Optimization
          • Deconvolution
          • Denoising
          • Distance Transformation
          • FloodFill
          • Grab Cut Algorithm
        • Color Filters
          • 2D Filter
          • Apply Mask
          • Bilateral Filter
          • Blur
          • Edge Filter
          • HSV Filter
          • Image Adaptive Threshold
          • Image Threshold
          • Invert Image
          • Morphological Transformations
          • Normalize Image
          • RGB Mask
          • RGB Set
          • Sobel Filter
        • Operations
          • Add Images Weighted
          • Add Images
          • Collage Images
          • Divide Images
          • Flip Image
          • Image AutoRotator
          • Image Concatenate
          • Image Resize
          • Image Resizer
          • Merge Channels
          • Multiply Images
          • Polar Transform
          • Rotate Image Angle
          • Slice Image
          • Split Image
          • Subtract Images
      • Detections/Shapes
        • Detectors
          • Barcode Reader
          • Blob Detector
          • Blur Detector
          • Circle Detector
          • Corner Detector
          • Custom CNN Model
          • Data Matrix Reader
          • Detect Reference
          • Feature Detector
          • Find Object - Multiple Image
          • Find Object
          • Find Reference
          • Harris Corner Filter
          • Line Detector
          • Match Shapes
          • Measure Object Distance
          • Shape Detector
        • Draw
          • Draw Detections
          • Draw Line
          • Draw Point
          • Draw Rectangle
          • Draw Result On Image
          • Write Date On Image
          • Write Text On Image
        • Roi Processing
          • Check Area (Polygon)
          • Check Area
          • Get Pixel Mouse
          • Get Pixel
          • Get ROI
          • Image ROI Center
          • Image ROI Polygon
          • Image ROI Select Multi
          • Image ROI Select
          • Image ROI
          • Perspective Transform
          • Rectangles in Rectangle
        • Shape Analysis
          • Approximate Contour
          • Choose Line
          • Contour to Image
          • Fill Contour
          • Find Contour
          • Hull Convex
          • Minimum Circle
          • Minimum Ellipse
          • Minimum Rectangle
          • Minimum Rotated Rectangle
          • Most Similar Shape
          • Point Polygon Test
      • Input/Output
        • Communication
          • Modbus Connect
          • Modbus Read
          • Modbus Write
          • MQTT Publish
          • MQTT Subscribe
          • OPC UA Client
          • OPC UA Read
          • OPC UA Write
          • REST API - Get
          • REST API - Post
          • Send Mail
          • Siemens S7 Connect
          • Siemens S7 Read
          • Siemens S7 Write
        • Data Inputs
          • Date-Time List
          • Date-Time
          • Headless Check
          • Keyboard/Barcode Reader
          • Logic Input
          • Number Input
          • Number Range
          • PWM (Pulse Width Modulation)
          • Rising Edge
          • String Input
          • Text
        • Image Inputs
          • Camera IP (ONVIF)
          • Camera IP
          • Camera USB External
          • Camera USB Vidgear
          • Camera USB
          • Load Image From Path
          • Load Image
          • Make Image
          • Pixel
          • Video
        • Outputs/Exports
          • CSV Export
          • Cycle Timer
          • File/Folder Operations
          • GPU Statistics
          • Image Logger
          • Image Write
          • Led Output
          • Multi Image Write
          • Output
          • Scope
          • Show Image
          • Stop
  • 📡Devices and Communication
    • Camera Usage
    • Communication Protocols
    • Further Reading
  • 🧩Example Projects
    • Demo Projects
    • Circumference Measurement
    • Object Counting
    • Tile Width Measurement
    • Human Detection
    • Object Detection
  • 🔑Key Features
    • Deploy Custom HMI Applications
    • Annotate Data for Object Detection
    • Train Custom AI Models
      • Choosing the Right Database
      • When to Stop Training
    • Create Plugins
      • Components
      • Coding Reference
    • Share Your Solutions with Community
    • Instal Python Packages
  • 📑FAQ
    • Contact Us
    • FAQ
    • Setting up a full project
  • Additional Resources
    • Training Schedule
    • Training Materials
    • AugeLab Experts
  • Appendix
    • Dictionary
    • References
Powered by GitBook
On this page
  • Bootstrap Phase
  • Mandatory Imports
  • Importing Community Modules
  • Class Definition
  • Class Attributes-Methods
  • `Block.op_code: str`
  • `Block.tooltip: str`
  • `Block.input_sockets: list[SocketType]`
  • `Block.output_sockets: list[SocketType]`
  • `Block.param: dict[str, Component]`
  • `Block.input: dict[str, object]`
  • `Block.output: dict[str, object]`
  • `Block.register_resource(name: str = '', path: str = '') -> str`
  • `Block.get_resource(name: str = '') -> str`
  • `Block.init(self)`
  • `Block.run(self)`
  • `QAFileDialog`
  • `add_block(My_Block.op_code, My_Block)`

Was this helpful?

  1. Key Features
  2. Create Plugins

Coding Reference

Sample custom block script provided in AugeLab:

Example_Block code
## Bootstrap phase
from studio.custom_block import *
# Importing of community modules 
import cv2
import numpy as np

## Class Definition 
class Example_Block(Block):
	op_code = 'Example_Block' # DO NOT CHANGE !!!, must be same as class name

	def init(self):
		self.width = 200
		self.height = 120
		self.tooltip = 'Increment image values by one.'

		self.input_sockets = [SocketTypes.ImageAny('in1')]
		self.output_sockets = [SocketTypes.ImageAny('out1')]

		self.param['text1'] = TextInput(text= '5')

	def run(self):
		in1 = self.input['in1'].data
		self.output['out1'].data = in1 + 1


add_block(Example_Block.op_code, Example_Block)

Bootstrap Phase

Mandatory Imports

Sample script always starts with imports of certain modules. from studio.custom_block import *imports necessary super classes, widgets and methods for you to utilize in your block. This line is mandatory for all class definitions.

Importing Community Modules

Here, most used two libraries are already set to be imported for you. You can use OpenCV and numpy libraries in your custom blocks.

You can also import custom libraries by installing them with Import Package Window and set-read custom static variables.

All blocks provided in AugeLab Studio is cross platform compatible. However, using community modules may compromise that.

Class Definition

Class Attributes-Methods

`Block.op_code: str`

op_code defines a unique identifier string for your custom block. To upload your custom block, you must choose a unique block name for your custom block.

`Block.tooltip: str`

tooltip allows you to show tooltips on your custom blocks when users hover over your custom block.

`Block.input_sockets: list[SocketType]`

SocketType takes two arguments:

...
SomeSocketClass(SocketTypes.BaseSocketClass):
    def __init__(self, name: str = '', multiple: bool = False):
        ''' 
            name: Text shown beside socket graphics
            multiple: Draw a horizontal line to indicate a list of type.
        '''
        ...

List of SocketTypes can be seen below:

  • [ImageAny]: ImageRGB | ImageGray

  • [ImageRGB]: npt.NDArray[np.uint8] # [N, N, 3]

  • [ImageGray]: npt.NDArray[np.uint8] # [N, N]

  • [Integer]: int

  • [Float]: int

  • [Number]: float | int

  • [Boolean]: bool

  • [String]: str

  • [Generic]: object

  • [Shape]: list[list[int, int], ...]

  • [Pixel]: tuple[int] | tuple[int, int, int]

  • [Point]: tuple[int, int]

`Block.output_sockets: list[SocketType]`

`Block.param: dict[str, Component]`

This property holds your block components, and interactable widgets by their unique names. There are several components you can utilize:

`Block.input: dict[str, object]`

input property is a dynamic dict that transfer data into your custom block. You can retrieve data from your input sockets by their unique socket names.

...
class Example_Block(Block):
    ...
    def init(self):
        ...
        self.input_sockets = [SocketTypes.ImageAny('Image'),
                              SocketTypes.Number('Constant')]
        ...
        
    def run(self):
        image = self.input['Image'].data
        constant = self.input['Image']
        ...

`Block.output: dict[str, object]`

output property is a dynamic dict that transfer data out of your custom block. You can place data into your output sockets by their unique socket names.

...
class Example_Block(Block):
    ...
    def init(self):
        ...
        self.output_sockets = [SocketTypes.ImageAny('Result'),
                              SocketTypes.Number('Detections')]
        ...
        
    def run(self):
        ...
        self.output['Result'].data = img_detections_drawn
        self.output['Detections'].data = n_detections
        

`Block.register_resource(name: str = '', path: str = '') -> str`

Registers paths and automatically saves them in the scenario file.

Normally, using raw paths may create problems during transferring scenario files across different computers. However, using automatic resource management allows you to use generic or relative paths. Simply storing a resource in a path lower than the scenario file will allow your script to receive the correct path no matter the where the root path is.

Arguments:

name: str : Unique name provided to distinguish a path.

path: str: Path to be registered.

Returns:

path: str: Registered path.

`Block.get_resource(name: str = '') -> str`

Allows you the receive the resource you have provided into resource manager of a custom block.

Arguments:

name: str : Unique name provided to distinguish a path.

Returns:

path: str: Registered path.

`Block.init(self)`

This part is executed every time when a custom block is dragged-dropped, copy-pasted, or loaded in a new scenario. It's mostly advised to use this section to:

  • Load resources for your custom block

  • Define components to be used (text inputs, buttons etc.)

  • Inner block states that change with runtime.

`Block.run(self)`

Run method is executed at every step of an execution of a scenario in AugeLab Studio. You can utilize your custom blocks inner states, custom modules, constants etc.

You can receive inputs by utilizing dynamic attributes provided by super Block class and send outputs as well, change configurations of your components and read component state to choose the right execution logic.

`QAFileDialog`

QAFileDialog is a static class that offers file path choosing dialog for users:

`QAFileDialog.getOpenFileName(**kwargs)`

Arguments

caption: str = '': Title of file dialog header

directory: str = '': Starting directory of the dialog

filter: str = '': Filenames to be filtered, for example -> 'Image Files (*.png *.jpg *.bmp)'

Returns

path:str: Chosen path by user.

`QAFileDialog.getExistingDirectory`

Arguments

caption: str = '': Title of file dialog header

directory: str = '': Starting directory of the dialog

Returns

path:str: Chosen path by user.

`add_block(My_Block.op_code, My_Block)`

This part is automatically generated by the Designer Window and should not be modified. If to be modified, make sure the block name is the same as class name and op_code.

PreviousComponentsNextShare Your Solutions with Community

Last updated 8 months ago

Was this helpful?

Name of your class is determined by whatever you've provided in Block Name text edit. You can introduce attributes or methods however you like in this section.

input_sockets attribute stores socket types. Each socket type is automatically generated for you in or section.

Same rules on applies to this section as well.

To receive the path provided, use method.

To register a path, use method.

🔑
title
Input Socket
Output Socket
Input_sockets
Text Input
Drop Down List
Label Text
Slider
Slider Labeled
Check Box
Button
Image
Table
get_resource
register_resource
Example Custom Block
Tooltip shown on custom block