Automate
edgemark.models.automate.automate
main
main(cfg_path=config_file_path, **kwargs)
Compile, upload, and test the models on the hardware device.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg_path
|
str
|
The path to the configuration file. The configuration file that this path points to should contain the following keys: - software_platform (str): The software platform to be tested. It should be one of the following: ['TFLM', 'EI', 'Ekkono', 'eAI_Translator'] - hardware_platform (str): The hardware platform to be tested. - linkers_dir (str): The directory containing the linker files. - save_dir (str): The directory to save the benchmarking results. - benchmark_overall_timeout (float): The overall timeout for reading the benchmark output in seconds. - benchmark_silence_timeout (float): The silence timeout for reading the benchmark output in seconds. |
config_file_path
|
**kwargs
|
dict
|
Keyword arguments to be passed to the configuration file. |
{}
|
Returns:
| Type | Description |
|---|---|
list
|
A list of dictionaries containing the following keys for each target model: - dir (str): The directory of the target model. - result (str): Result of the model generation. It can be either "success" or "failed". - error (str): Error message in case of failure. - traceback (str): Traceback in case of failure. Either this or 'error_file' will be present. - error_file (str): The path to the error file in case of failure. Either this or 'traceback' will be present. |
Source code in edgemark/models/automate/automate.py
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 | |
edgemark.models.automate.investigator
find_exe_time
find_exe_time(text)
Find the execution time from the text.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
The text to search. |
required |
Returns:
| Type | Description |
|---|---|
tuple
|
A tuple of (n_tests, avg_ms, std_ms, avg_ticks, std_ticks). |
Source code in edgemark/models/automate/investigator.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
find_prediction_mae
find_prediction_mae(text)
Find the mean absolute error (MAE) from the text.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
The text to search. |
required |
Returns:
| Type | Description |
|---|---|
tuple
|
A tuple of (n_tests, avg_mae, std_mae). |
Source code in edgemark/models/automate/investigator.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
edgemark.models.automate.hardware_template
This module contains a template class that other hardware classes should inherit from.
HardwareTemplate
This class is a template for hardware classes. In order to create a new hardware class, you should inherit from this class and implement its abstract functions.
Source code in edgemark/models/automate/hardware_template.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |
BoardNotFoundError
Bases: Exception
Exception raised when the board is not found.
Source code in edgemark/models/automate/hardware_template.py
25 26 27 28 29 | |
FlashExceededError
Bases: Exception
Exception raised when the hardware's required flash usage exceeds its size.
Source code in edgemark/models/automate/hardware_template.py
18 19 20 21 22 | |
RAMExceededError
Bases: Exception
Exception raised when the hardware's required RAM usage exceeds its size.
Source code in edgemark/models/automate/hardware_template.py
11 12 13 14 15 | |
__init__
__init__(software_platform)
Initializes the hardware class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
software_platform
|
str
|
The software platform that will be used with this hardware. |
required |
Source code in edgemark/models/automate/hardware_template.py
32 33 34 35 36 37 38 39 | |
build_project
build_project(clean=False)
Builds the project.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
clean
|
bool
|
Whether to clean the project before building. |
False
|
Returns:
| Type | Description |
|---|---|
tuple
|
A tuple containing text_size, data_size, and bss_size. |
Raises:
| Type | Description |
|---|---|
RAMExceededError
|
If the hardware's required RAM usage exceeds its size. |
Exception
|
If for other reasons, the project cannot be built. |
Source code in edgemark/models/automate/hardware_template.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
get_model_dir
get_model_dir()
Returns the directory where the model files can go.
Returns:
| Type | Description |
|---|---|
str
|
The directory where the model files can go. |
Source code in edgemark/models/automate/hardware_template.py
42 43 44 45 46 47 48 49 | |
read_output
staticmethod
read_output(overall_timeout, silence_timeout, keyword=None, verbose=False)
Reads the output from the hardware.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
overall_timeout
|
int
|
The overall timeout for reading. |
required |
silence_timeout
|
int
|
The silence timeout for reading. |
required |
keyword
|
str
|
The keyword to stop reading at. |
None
|
verbose
|
bool
|
Whether to print the output as it is read. |
False
|
Returns:
| Type | Description |
|---|---|
str
|
The output read from the hardware. |
Raises:
| Type | Description |
|---|---|
BoardNotFoundError
|
If the board is not found. |
TimeoutError
|
If reading times out. |
Exception
|
If for other reasons, the output is not complete. |
Source code in edgemark/models/automate/hardware_template.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |
upload_program
upload_program()
Uploads the program to the hardware.
Raises:
| Type | Description |
|---|---|
Exception
|
If the program cannot be uploaded. |
Source code in edgemark/models/automate/hardware_template.py
69 70 71 72 73 74 75 76 | |