forked from mlcommons/tiny
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add runner code * .gitignore * New Images * Fix gitignores * Cleanup * Start cleaning up the devices * Automatically generate the dut info * Automatically power on the dut * Run the image_classification test * Power management running * Execute dut in performance mode * Update images
- Loading branch information
Showing
14 changed files
with
359 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.idea | ||
datasets | ||
venv | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import csv | ||
import os | ||
from random import randrange | ||
|
||
|
||
class DataSet: | ||
def __init__(self, dataset_path, truth_file): | ||
self._dataset_path = dataset_path | ||
self._truth_file = truth_file | ||
self._truth_data = None | ||
|
||
def _read_truth_file(self): | ||
if not self._truth_data: | ||
with open(os.path.join(self._dataset_path, self._truth_file)) as file: | ||
reader = csv.DictReader(file, fieldnames=["file", "classes", "class"]) | ||
self._truth_data = [f for f in reader] | ||
|
||
def get_file_by_index(self, index): | ||
self._read_truth_file() | ||
data = [] | ||
index = index if index is not None else randrange(len(self._truth_data)) | ||
truth = None | ||
if index < len(self._truth_data): | ||
truth = self._truth_data[index] | ||
with open(os.path.join(self._dataset_path, truth.get("file")), "rb") as file: | ||
data = file.read() | ||
return truth, data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.