Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
active_learning_pipeline
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sikhin.vc
active_learning_pipeline
Commits
1152e850
Commit
1152e850
authored
Mar 03, 2023
by
sikhin.vc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new file
parent
fd1d6fc4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
0 deletions
+42
-0
data_collect.py
data_collect.py
+42
-0
No files found.
data_collect.py
0 → 100644
View file @
1152e850
import
cv2
import
time
import
datetime
import
os
class
DataCollector
():
def
__init__
(
self
,
stream
,
project
,
loader
,
camera
,
duration
):
self
.
stream
=
stream
self
.
project
=
project
self
.
loader
=
loader
self
.
camera
=
camera
self
.
duration
=
duration
self
.
status
=
"raw"
def
data_collector
(
self
):
cap
=
cv2
.
VideoCapture
(
self
.
stream
)
ret
,
img
=
cap
.
read
()
start_time
=
time
.
time
()
frame_count
=
0
while
ret
:
img
=
cv2
.
resize
(
img
,
(
416
,
416
))
current_date_time
=
datetime
.
datetime
.
now
()
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
current_date_time
=
current_date_time
.
replace
(
"-"
,
""
)
current_date_time
=
current_date_time
.
replace
(
" "
,
""
)
current_date_time
=
current_date_time
.
replace
(
":"
,
""
)
dest_name
=
self
.
project
+
"_"
+
self
.
loader
+
"_"
+
self
.
camera
+
"_"
+
current_date_time
+
"_"
+
str
(
frame_count
)
+
"_"
+
self
.
status
+
".jpg"
current_dir
=
os
.
getcwd
()
temp_path
=
os
.
path
.
join
(
current_dir
,
"temp"
)
if
not
(
os
.
path
.
exists
(
temp_path
)):
os
.
mkdir
(
temp_path
)
dest_path
=
os
.
path
.
join
(
temp_path
,
dest_name
)
cv2
.
imwrite
(
dest_path
,
img
)
frame_count
+=
1
ret
,
img
=
cap
.
read
()
end_time
=
time
.
time
()
if
((
end_time
-
start_time
)
>
float
(
self
.
duration
)):
ret
=
False
frame_count
=
0
s
=
DataCollector
(
stream
=
"rtsp://user:myPass@123@192.168.0.51:554/Streaming/Channels/102"
,
project
=
"jk"
,
loader
=
"1"
,
camera
=
"1"
,
duration
=
1
)
s
.
data_collector
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment