new config
This commit is contained in:
parent
fb785dab53
commit
f7cf37dbf0
@ -2,8 +2,10 @@
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="f410c5c2-3ffe-4260-93eb-e3d83256d263" name="Default Changelist" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/example.env" beforeDir="false" afterPath="$PROJECT_DIR$/example.env" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/camera.py" beforeDir="false" afterPath="$PROJECT_DIR$/camera.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/capture.jpg" beforeDir="false" afterPath="$PROJECT_DIR$/capture.jpg" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/index.py" beforeDir="false" afterPath="$PROJECT_DIR$/index.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ref-img.jpg" beforeDir="false" afterPath="$PROJECT_DIR$/ref-img.jpg" afterDir="false" />
|
||||
</list>
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
@ -13,11 +15,11 @@
|
||||
</component>
|
||||
<component name="FileEditorManager">
|
||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/index.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="375">
|
||||
<caret line="25" column="56" selection-start-line="25" selection-start-column="56" selection-end-line="25" selection-end-column="56" />
|
||||
<state relative-caret-position="450">
|
||||
<caret line="42" column="46" lean-forward="true" selection-start-line="42" selection-start-column="46" selection-end-line="42" selection-end-column="46" />
|
||||
<folding>
|
||||
<element signature="e#0#21#0" expanded="true" />
|
||||
</folding>
|
||||
@ -25,21 +27,16 @@
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/lib/test-images/lot-5-cars-A.jpg">
|
||||
<provider selected="true" editor-type-id="images" />
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/lib/test-images/lot-5-cars-B.jpg">
|
||||
<provider selected="true" editor-type-id="images" />
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/camera.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="105">
|
||||
<caret line="7" column="44" selection-start-line="7" selection-start-column="44" selection-end-line="7" selection-end-column="44" />
|
||||
<state relative-caret-position="165">
|
||||
<caret line="11" column="14" selection-start-line="11" selection-start-column="14" selection-end-line="11" selection-end-column="14" />
|
||||
<folding>
|
||||
<element signature="e#0#13#0" expanded="true" />
|
||||
</folding>
|
||||
@ -65,16 +62,11 @@
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/lib/test-images/lot-3-cars.jpg">
|
||||
<provider selected="true" editor-type-id="images" />
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/image_tools.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="45">
|
||||
<caret line="3" column="23" lean-forward="true" selection-start-line="3" selection-start-column="23" selection-end-line="3" selection-end-column="23" />
|
||||
<caret line="3" column="23" selection-start-line="3" selection-start-column="23" selection-end-line="3" selection-end-column="23" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@ -82,8 +74,8 @@
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/.env">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="75">
|
||||
<caret line="5" column="35" selection-start-line="5" selection-start-column="35" selection-end-line="5" selection-end-column="35" />
|
||||
<state relative-caret-position="45">
|
||||
<caret line="3" column="18" selection-start-line="3" selection-start-column="18" selection-end-line="3" selection-end-column="18" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@ -115,11 +107,11 @@
|
||||
<option value="$PROJECT_DIR$/image_diff_color.py" />
|
||||
<option value="$PROJECT_DIR$/.gitignore" />
|
||||
<option value="$PROJECT_DIR$/config.py" />
|
||||
<option value="$PROJECT_DIR$/camera.py" />
|
||||
<option value="$PROJECT_DIR$/image_tools.py" />
|
||||
<option value="$PROJECT_DIR$/example.env" />
|
||||
<option value="$PROJECT_DIR$/.env" />
|
||||
<option value="$PROJECT_DIR$/index.py" />
|
||||
<option value="$PROJECT_DIR$/.env" />
|
||||
<option value="$PROJECT_DIR$/camera.py" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
@ -141,6 +133,11 @@
|
||||
<item name="python-backend" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="python-backend" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="python-backend" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="python-backend" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="test-images-vert" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</subPane>
|
||||
@ -236,7 +233,7 @@
|
||||
<entry file="file://$PROJECT_DIR$/image_tools.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="45">
|
||||
<caret line="3" column="23" lean-forward="true" selection-start-line="3" selection-start-column="23" selection-end-line="3" selection-end-column="23" />
|
||||
<caret line="3" column="23" selection-start-line="3" selection-start-column="23" selection-end-line="3" selection-end-column="23" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@ -257,16 +254,6 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/camera.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="105">
|
||||
<caret line="7" column="44" selection-start-line="7" selection-start-column="44" selection-end-line="7" selection-end-column="44" />
|
||||
<folding>
|
||||
<element signature="e#0#13#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example.env">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="75">
|
||||
@ -274,22 +261,32 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/.env">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="75">
|
||||
<caret line="5" column="35" selection-start-line="5" selection-start-column="35" selection-end-line="5" selection-end-column="35" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/index.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="375">
|
||||
<caret line="25" column="56" selection-start-line="25" selection-start-column="56" selection-end-line="25" selection-end-column="56" />
|
||||
<state relative-caret-position="450">
|
||||
<caret line="42" column="46" lean-forward="true" selection-start-line="42" selection-start-column="46" selection-end-line="42" selection-end-column="46" />
|
||||
<folding>
|
||||
<element signature="e#0#21#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/.env">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="45">
|
||||
<caret line="3" column="18" selection-start-line="3" selection-start-column="18" selection-end-line="3" selection-end-column="18" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/camera.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="165">
|
||||
<caret line="11" column="14" selection-start-line="11" selection-start-column="14" selection-end-line="11" selection-end-column="14" />
|
||||
<folding>
|
||||
<element signature="e#0#13#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</component>
|
||||
</project>
|
BIN
ai_image.jpg
Normal file
BIN
ai_image.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 44 KiB |
BIN
ai_image.out.jpg
Normal file
BIN
ai_image.out.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 77 KiB |
@ -9,6 +9,7 @@ def capture(camera_stream = "/dev/video4"):
|
||||
cam.start()
|
||||
img = cam.get_image()
|
||||
pygame.image.save(img, './capture.jpg')
|
||||
cam.stop()
|
||||
return './capture.jpg'
|
||||
|
||||
|
||||
|
BIN
capture.jpg
BIN
capture.jpg
Binary file not shown.
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 29 KiB |
9
index.py
9
index.py
@ -18,8 +18,11 @@ firebase_admin.initialize_app(cred)
|
||||
|
||||
db = firestore.client()
|
||||
|
||||
doc_conf = db.collection('configurations').document(os.getenv('CONFIG_CODE')).get().to_dict()
|
||||
print(doc_conf)
|
||||
|
||||
def poll():
|
||||
doc_ref_lot = db.collection('lots').document(os.getenv('LOT_NAME'))
|
||||
doc_ref_lot = db.collection('lots').document(doc_conf['lot_id'])
|
||||
|
||||
# Get the reference image
|
||||
lot_info = doc_ref_lot.collection('info').document('lotInfo').get().to_dict()
|
||||
@ -27,7 +30,7 @@ def poll():
|
||||
reference = Image.open('./ref-img.jpg').load()
|
||||
|
||||
# Take the picture
|
||||
img = Image.open(camera.capture(os.getenv('CAMERA_DEVICE'))).load()
|
||||
img = Image.open(camera.capture(doc_conf['stream'])).load()
|
||||
#img = Image.open('./lib/test-images-vert/lot-3-cars.jpg').load()
|
||||
|
||||
doc_ref_stalls = doc_ref_lot.collection('stalls').get()
|
||||
@ -36,7 +39,7 @@ def poll():
|
||||
stall_obj = stall.to_dict()
|
||||
color_reference = image_tools.average_color(stall_obj['locationX'], stall_obj['locationY'], stall_obj['width'], stall_obj['height'], reference)
|
||||
color_compare = image_tools.average_color(stall_obj['locationX'], stall_obj['locationY'], stall_obj['width'], stall_obj['height'], img)
|
||||
stall_occupied = image_tools.threshold(image_tools.differences(color_reference, color_compare), float(os.getenv('E_HAT_TRIGGER_LEVEL')))
|
||||
stall_occupied = image_tools.threshold(image_tools.differences(color_reference, color_compare), float(doc_conf['e_hat']))
|
||||
stall_obj['open'] = not stall_occupied
|
||||
print("Updated: "+stall.id)
|
||||
|
||||
|
BIN
ref-img.jpg
BIN
ref-img.jpg
Binary file not shown.
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 35 KiB |
BIN
resnet50_coco_best_v2.0.1.h5
Normal file
BIN
resnet50_coco_best_v2.0.1.h5
Normal file
Binary file not shown.
14
tensor.py
Normal file
14
tensor.py
Normal file
@ -0,0 +1,14 @@
|
||||
from imageai.Detection import ObjectDetection
|
||||
import os
|
||||
|
||||
execution_path = os.getcwd()
|
||||
|
||||
detector = ObjectDetection()
|
||||
detector.setModelTypeAsRetinaNet()
|
||||
detector.setModelPath(os.path.join(execution_path, "resnet50_coco_best_v2.0.1.h5"))
|
||||
detector.loadModel()
|
||||
|
||||
detections = detector.detectObjectsFromImage(input_image=os.path.join(execution_path, "ai_image.jpg"), output_image_path=os.path.join(execution_path , "ai_image.out.jpg"))
|
||||
|
||||
for eachObject in detections:
|
||||
print(eachObject["name"] , " : " , eachObject["percentage_probability"] )
|
Loading…
Reference in New Issue
Block a user