-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #983 from anarkiwi/noyolo
move image_inference output to simple log, since it generates labelled images itself.
- Loading branch information
Showing
10 changed files
with
66 additions
and
136 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
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
File renamed without changes.
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,51 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
import json | ||
import sys | ||
import numpy as np | ||
|
||
try: | ||
from gnuradio import gr # pytype: disable=import-error | ||
except ModuleNotFoundError as err: # pragma: no cover | ||
print( | ||
"Run from outside a supported environment, please run via Docker (https://github.com/IQTLabs/gamutRF#readme): %s" | ||
% err | ||
) | ||
sys.exit(1) | ||
|
||
|
||
DELIM = "\n\n" | ||
|
||
|
||
class inference2mqtt(gr.sync_block): | ||
def __init__( | ||
self, | ||
): | ||
self.yaml_buffer = "" | ||
|
||
gr.sync_block.__init__( | ||
self, | ||
name="inference2mqtt", | ||
in_sig=[np.ubyte], | ||
out_sig=None, | ||
) | ||
|
||
def work(self, input_items, output_items): | ||
n = 0 | ||
for input_item in input_items: | ||
raw_input_item = input_item.tobytes().decode("utf8") | ||
n += len(raw_input_item) | ||
self.yaml_buffer += raw_input_item | ||
while True: | ||
delim_pos = self.yaml_buffer.find(DELIM) | ||
if delim_pos == -1: | ||
break | ||
raw_item = self.yaml_buffer[:delim_pos] | ||
item = json.loads(raw_item) | ||
self.yaml_buffer = self.yaml_buffer[delim_pos + len(DELIM) :] | ||
self.process_item(item) | ||
return n | ||
|
||
def process_item(self, item): | ||
print(item) | ||
return |
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
This file was deleted.
Oops, something went wrong.
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
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