Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Module_10_Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ştefan, R.P. (Răzvan, Student B-TCS)
Module_10_Project
Commits
8d54c64a
Commit
8d54c64a
authored
4 months ago
by
razvan841
Browse files
Options
Downloads
Patches
Plain Diff
added .env variables
parent
794c182f
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Color_detection/raspberryPi.py
+6
-1
6 additions, 1 deletion
Color_detection/raspberryPi.py
Color_detection/rubiks_cube_color_classifier.py
+5
-1
5 additions, 1 deletion
Color_detection/rubiks_cube_color_classifier.py
main.py
+9
-2
9 additions, 2 deletions
main.py
with
20 additions
and
4 deletions
Color_detection/raspberryPi.py
+
6
−
1
View file @
8d54c64a
...
...
@@ -2,8 +2,13 @@ import cv2
import
numpy
as
np
from
tensorflow.keras.models
import
load_model
# type: ignore
import
os
from
dotenv
import
load_dotenv
DEBUGGING
=
True
load_dotenv
()
# Access environment variables
DEBUGGING
=
os
.
getenv
(
'
DEBUGGING
'
)
def
extract_patches
(
image
):
height
,
width
,
_
=
image
.
shape
...
...
This diff is collapsed.
Click to expand it.
Color_detection/rubiks_cube_color_classifier.py
+
5
−
1
View file @
8d54c64a
...
...
@@ -4,8 +4,12 @@ from tensorflow.keras.models import Sequential # type: ignore
from
tensorflow.keras.layers
import
Conv2D
,
MaxPooling2D
,
Flatten
,
Dense
# type: ignore
import
os
import
json
from
dotenv
import
load_dotenv
DEBUGGING
=
True
load_dotenv
()
# Access environment variables
DEBUGGING
=
os
.
getenv
(
'
DEBUGGING
'
)
# extract 9 patches from the image assuming the image
# contains only the cube and is properly aligned.
def
extract_patches
(
image
):
...
...
This diff is collapsed.
Click to expand it.
main.py
+
9
−
2
View file @
8d54c64a
...
...
@@ -4,9 +4,16 @@ from mpl_toolkits.mplot3d.art3d import Poly3DCollection
import
numpy
as
np
from
ultralytics
import
YOLO
import
cv2
from
tensorflow.keras.models
import
load_model
from
tensorflow.keras.models
import
load_model
# type: ignore
from
Color_detection
import
raspberryPi
import
os
from
dotenv
import
load_dotenv
load_dotenv
()
# Access environment variables
CAMERA_INDEX
=
os
.
getenv
(
'
CAMERA_INDEX
'
)
# Initialize cube state
cube_state
=
{
...
...
@@ -131,7 +138,7 @@ def draw_cube(state):
model
=
YOLO
(
r
"
Cube_detection/runs/detect/best/weights/best.pt
"
)
# Open video capture
cap
=
cv2
.
VideoCapture
(
1
)
cap
=
cv2
.
VideoCapture
(
CAMERA_INDEX
)
print
(
"
Press
'
q
'
to quit.
"
)
model_path
=
r
"
Color_detection/rubiks_cube_model.h5
"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment