backend¶
io¶
Backend IO operations
:members:
base¶
Base classes and methods for other BEAGLES modules
-
class
beagles.base.
PreprocessedBox
[source]¶ Holds a box returned from a cython box constructor
-
x
¶ Alias for field number 0
-
y
¶ Alias for field number 1
-
w
¶ Alias for field number 2
-
h
¶ Alias for field number 3
-
c
¶ Alias for field number 4
-
probs
¶ Alias for field number 5
-
-
class
beagles.base.
ProcessedBox
[source]¶ Holds a box returned by a backend framework’s process_box and findboxes methods.
-
left
¶ Alias for field number 0
-
right
¶ Alias for field number 1
-
top
¶ Alias for field number 2
-
bot
¶ Alias for field number 3
-
label
¶ Alias for field number 4
-
max_idx
¶ Alias for field number 5
-
max_prob
¶ Alias for field number 6
-
-
class
beagles.base.
PostprocessedBox
[source]¶ Holds labeled bounding box returned by framework’s postprocess method.
-
xmin
¶ Alias for field number 0
-
ymin
¶ Alias for field number 1
-
xmax
¶ Alias for field number 2
-
ymax
¶ Alias for field number 3
-
label
¶ Alias for field number 4
-
difficult
¶ Alias for field number 5
-
-
class
beagles.base.
Flags
(defaults=True)[source]¶ Allows you to set and get {key: value} pairs like attributes. Compatible with argparse.Namespace objects. Enforces type-checking during flag setting.
-
class
beagles.base.
Shape
(label=None, line_color=None, difficult=False, paintLabel=False)[source]¶ -
P_SQUARE
= 0¶
-
P_ROUND
= 1¶
-
MOVE_VERTEX
= 0¶
-
NEAR_VERTEX
= 1¶
-
fill_color
= <PyQt5.QtGui.QColor object>¶
-
select_line_color
= <PyQt5.QtGui.QColor object>¶
-
select_fill_color
= <PyQt5.QtGui.QColor object>¶
-
vertex_fill_color
= <PyQt5.QtGui.QColor object>¶
-
hvertex_fill_color
= <PyQt5.QtGui.QColor object>¶
-
point_type
= 1¶
-
point_size
= 8¶
-
scale
= 1.0¶
-
line_color
= <PyQt5.QtGui.QColor object>¶
-
-
beagles.base.
getStr
(strId: str) → str[source]¶ Convenience function to grab strings from
StringBundle
- Args:
- strId: resource ID for the string to get
- Returns:
- str matching the resource ID
-
class
beagles.base.
SubsystemPrototype
(create_key, *args, **kwargs)[source]¶ -
create_key
= <object object>¶
-
-
beagles.base.
register_subsystem
(token: Union[AnyStr, List[T]], prototype: Type[beagles.base.SubsystemPrototype]) → Callable[source]¶ Decorator to register
Subsystem
metadata tokens to aSubsystemPrototype
- Example:
Can be used with a single text token…
@register_subsystem(token='[detection]', prototype=Framework) class Yolo(Subsystem): ...
>>> Yolo.token {'[detection]': Yolo}
Or can be be used with multiple token splitting on space…
@register_subsystem(token='sse l1 l2 smooth sparse softmax', prototype=Framework) class NeuralNet(Subsystem): ...
>>> NeuralNet.token {'sse': NeuralNet, l1: NeuralNet, l2: NeuralNet, ...}
- Returns:
- A registered
Subsystem
withSubsystem.token
set to {cls: token} and it’s__mro__
overridden with prototype. - Raises:
- TypeError: If
Subsystem
orSubsystemPrototype
isn’t in the registered class MRO
io¶
resources¶
Files to bundle into compiled resources using pyrcc5 from the Qt resource system.
resources.qrc¶
Manifest of all resource files to bundle. Icons are aliased to action names and strings are aliased as their file basename.
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<!-- resource and locale-specific resource paths -->
<file alias="showInfo">icons/help.png</file>
<file alias="showTutorialDialog">icons/help.png</file>
<file alias="app">icons/app.png</file>
<file alias="advancedMode">icons/expert2.png</file>
<file alias="done">icons/done.png</file>
<file alias="file">icons/file.png</file>
<file alias="labels">icons/labels.png</file>
<file alias="setCreateMode">icons/objects.png</file>
<file alias="createShape">icons/objects.png</file>
<file alias="close">icons/close.png</file>
<file alias="setFitWidth">icons/fit-width.png</file>
<file alias="setFitWin">icons/fit-window.png</file>
<file alias="undo">icons/undo.png</file>
<file alias="hideAll">icons/eye.png</file>
<file alias="showAll">icons/eye.png</file>
<file alias="close">icons/quit.png</file>
<file alias="closeFile">icons/quit.png</file>
<file alias="copySelectedShape">icons/copy.png</file>
<file alias="setEditMode">icons/edit.png</file>
<file alias="editLabel">icons/edit.png</file>
<file alias="openFile">icons/openFile.png</file>
<file alias="openDir">icons/open.png</file>
<file alias="changeSaveDir">icons/changeSaveDir.png</file>
<file alias="openAnnotation">icons/openAnnotation.png</file>
<file alias="impVideo">icons/impVideo.png</file>
<file alias="switchmeon">icons/switchmeon.png</file>
<file alias="switchmeoff">icons/switchmeoff.png</file>
<file alias="trainModel">icons/trainModel.png</file>
<file alias="visualize">icons/visualize.png</file>
<file alias="commitAnnotatedFrames">icons/commitAnnotatedFrames.png</file>
<file alias="frameByFrame">icons/frameByFrame.png</file>
<file alias="demoWebcam">icons/demoWebcam.png</file>
<file alias="saveFile">icons/save.png</file>
<file alias="changeFormat">icons/format_voc.png</file>
<file alias="format_voc">icons/format_voc.png</file>
<file alias="format_yolo">icons/format_yolo.png</file>
<file alias="saveAs">icons/save-as.png</file>
<file alias="shapeFillColor">icons/color.png</file>
<file alias="boxLineColor">icons/color_line.png</file>
<file alias="shapeLineColor">icons/color_line.png</file>
<file alias="zoomOrg">icons/zoom.png</file>
<file alias="zoomIn">icons/zoom-in.png</file>
<file alias="zoomOut">icons/zoom-out.png</file>
<file alias="delBox">icons/cancel.png</file>
<file alias="nextImg">icons/next.png</file>
<file alias="prevImg">icons/prev.png</file>
<file alias="resetAll">icons/resetall.png</file>
<file alias="verifyImg">icons/verify.png</file>
<file alias="strings">strings/strings.properties</file>
<file alias="strings-zh-TW">strings/strings-zh-TW.properties</file>
<file alias="strings-zh-CN">strings/strings-zh-CN.properties</file>
<file alias="strings-te-IN">strings/strings-te-IN.properties</file>
<file alias="strings-ru-RU">strings/strings-ru-RU.properties</file>
<file alias="strings-pt-BZ">strings/strings-pt-BZ.properties</file>
<file alias="strings-ja-JP">strings/strings-ja-JP.properties</file>
<file alias="strings-hi-IN">strings/strings-hi-IN.properties</file>
<file alias="strings-es-MX">strings/strings-es-MX.properties</file>
<file alias="strings-bn-IN">strings/strings-bn-IN.properties</file>
</qresource>
</RCC>
actions¶
Each action will have an entry in actions.json, an entry of the same
name for the main string strings.properties, and an entry in
resources.qrc that points to the icon for the action contained in
resources/icons
.
actions.json¶
Serialized partial arguments for the beagles.ui.newAction()
constructor,
each entry contains a keyboard shortcut, a boolean whether the action is enabled,
and a boolean whether the action is checkable.
{
"openFile":["Ctrl+o", false, true],
"openDir": ["Ctrl+u", false, true],
"impVideo":["Ctrl+i", false, true],
"changeSaveDir":["Ctrl+r", false, true],
"openAnnotation":["Ctrl+Shift+o", false, true],
"nextImg":["d", false, true],
"prevImg":["a", false, true],
"verifyImg":["space", false, true],
"saveFile":["Ctrl+s", false, false],
"changeFormat":[null, false, true],
"saveAs":["Ctrl+Shift+s", false, false],
"closeFile":["Ctrl+w", false, true],
"resetAll":[null, false, true],
"boxLineColor":["Ctrl+l", false, true],
"setCreateMode":["w", false, false],
"createShape":["w", false, false],
"setEditMode":["e", false, false],
"commitAnnotatedFrames":[null, false, true],
"visualize":[null, false, true],
"hideAll":["Ctrl+h", false, false],
"showAll":["Ctrl+a", false, false],
"trainModel":["Ctrl+t", false, true],
"delBox":["Delete", false, false],
"advancedMode":["Ctrl+Shift+a", true, true],
"showInfo":[null, false, true],
"showTutorialDialog":[null, false, true],
"close":["Ctrl+q", false, true],
"zoomIn":["Ctrl++", false, false],
"zoomOut":["Ctrl+-", false, false],
"zoomOrg":["Ctrl+Shift++", false, false],
"setFitWin":["Ctrl+f", true, false],
"setFitWidth":["Ctrl+Shift+f", true, false],
"editLabel":["Ctrl+e", false, false],
"shapeFillColor": [null, false, false],
"shapeLineColor":[null, false, false],
"copySelectedShape":["Ctrl+d", false, false]
}
strings¶
String resources and localized translations for Qt
strings.properties¶
openFile=Open
openFileDetail=Open image or label file
close=Quit
closeDetail=Quit Application
openDir=Open Folder
openDirDetail=Open Folder
impVideo=Import Video Frames
impVideoDetail=Import raw video frames for annotation
commitAnnotatedFrames=Commit Annotations
commitAnnotatedFramesDetail=Dump annotated frames into the data folder
trainModel=Train a Model
trainModelDetail=Choose a model to train on the data folder
visualize=Visualize Model
visualizeDetail=Visualize model using tensorboard
frameByFrame=Annotate a Video
frameByFrameDetail=Choose a video file to annotate frame by frame
demoWebcam=Demo Model on Webcam
demoWebcamDetail=Demonstrate the model using a webcam
changeSaveDirDetail=Change default saved Annotation dir
openAnnotation=Open Annotation
openAnnotationDetail=Open an annotation file
changeSaveDir=Change Save Folder
nextImg=Next Image
nextImgDetail=Open the next Image
prevImg=Prev Image
prevImgDetail=Open the previous Image
verifyImg=Verify Image
verifyImgDetail=Verify Image
saveFile=Save
train=Train
predict=Predict
annotate=Annotate
analyze=Analyze
selectProject=Select Project
projectLayout=Project Name
flowCmb=Mode
modelCmb=Model
loadCmb=Checkpoint
thresholdSpd=Threshold
verbaliseChb=Verbose
jsonChb=Output JSON Annotations
vocChb=Output VOC Annotations
trainerCmb=Training Algorithm
momentumSpd=Momentum
learningModeCmb=Learning Mode
learningRateSpd=Initial Learning Rate
maxLearningRateSpd=Maximum Learning Rate
stepSizeCoefficient=Step Size Coefficient
keepSpb=Checkpoints to Keep
batchSpb=Batch Size
epochSpb=Epochs to Run
saveSpb=Save Every
clipLayout=Clip Gradients
updateAnchorChb=Update Anchors
triangularTip=By default, the learning rate increases linearly in each cycle and then decreases linearly.
triangular2Tip=The same as the triangular policy except the learning rate difference is cut in half at the end of each cycle. This means the learning rate difference drops after each cycle.
exp_rangeTip=The learning rate varies between the minimum and maximum boundaries, and the exponential factor for each boundary value drop is: γ^global_step
momentumTip=Momentum setting for momentum and rmsprop optimizer
saveFileDetail=Save the labels to a file
changeFormatDetail=Change save format
saveAs=Save As
saveAsDetail=Save the labels to a different file
closeFile=Close
closeFileDetail=Close the current file
resetAll=Reset All
resetAllDetail=Reset All
boxLineColor=Box Line Color
boxLineColorDetail=Choose Box line color
createShape=Create Box
createShapeDetail=Draw a new box
setCreateMode=Create Box
setCreateModeDetail=Draw a new box
delBox=Delete Box
delBoxDetail=Remove the box
copySelectedShape=Duplicate Box
copySelectedShapeDetail=Create a duplicate of the selected box
showTutorialDialog=Tutorial
showTutorialDialogDetail=Show demo
showInfo=Information
showInfoDetail=App Information
zoomIn=Zoom In
zoomInDetail=Increase zoom level
zoomOut=Zoom Out
zoomOutDetail=Decrease zoom level
zoomOrg=Original size
zoomOrgDetail=Zoom to original size
setFitWin=Fit Window
setFitWinDetail=Zoom follows window size
setFitWidth=Fit Widith
setFitWidthDetail=Zoom follows window width
editLabel=Edit Label
editLabelDetail=Modify the label of the selected Box
shapeLineColor=Shape Line Color
shapeLineColorDetail=Change the line color for this specific shape
shapeFillColor=Shape Fill Color
shapeFillColorDetail=Change the fill color for this specific shape
showHide=Show/Hide Label Panel
useDefaultLabel=Use default label
useDifficult=difficult
boxLabelText=Box Labels
labels=Labels
autoSaveMode=Auto Save mode
singleClsMode=Single Class Mode
displayLabel=Display Labels
fileList=File List
files=Files
advancedMode=Advanced Mode
advancedModeDetail=Swtich to advanced mode
showAllDetail=Show all bounding boxes
showAll=Show Bounding Box
hideAllDetail=Hide all bounding boxes
hideAll=Hide Bounding Box
changeFormat=&PascalVOC
setEditMode=Edit Box
setEditModeDetail=Move and edit boxes
scripts¶
RAMDisk¶
MacOS-specific tool used by beagles.io.SharedMemory
to create a shared memory drive.
#! /bin/sh
NAME="$(basename $0)"
VOLUMEPATH="/Volumes"
if [ "$(uname)" != "Darwin" ]; then
>&2 echo Error: $0 script is only designed to be run on macOS
exit 1
fi
RAMDisk_mount() {
if [ ! -d "$VOLUMEPATH/$NAME" ]; then
diskutil eraseVolume HFS+ $NAME `hdiutil attach -nomount ram://$((2048 * 2))`
exit
else
exit 1
fi
}
RAMDisk_unmount() {
while true
do
CURDISK=$(diskutil info $NAME | grep -o '/dev/disk[1-99]')
if [ "$CURDISK" = "" ]; then
>&2 echo $NAME not mounted in $VOLUMEPATH
exit 1
else
echo "$1 $NAME @ $CURDISK"
hdiutil detach $CURDISK
fi
done
}
eval ${NAME}_${1} ${1}
#if [[ "$1" = "mount" ]]; then
# RAMDisk_mount
#elif [[ "$1" = "unmount" ]]; then
# RAMDisk_unmount
#else
# >&2 echo "line $LINENO: $NAME_$1: command not found"
#fi
ui¶
-
beagles.ui.
newAction
(parent, text, slot=None, shortcut=None, icon=None, tip=None, checkable=False, enabled=True)[source]¶ Create a new action and assign callbacks, shortcuts, etc.
-
beagles.ui.
distance
(p: PyQt5.QtCore.QPointF) → float[source]¶ - Returns:
- Distance from the origin (0,0).
callbacks¶
Action callbacks for menu/toolbar actions defined in actions.json
functions¶
Dependency methods for beagles.ui.callbacks
widgets¶
QWidget children used the BEAGLES UI