You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then I have 2 lines to count the different classes, works fine, I can output the total with no issue.
Is it possible to write the time in video or perhaps only write it every x minutes for example to calculate the volume between entries?
Example code:
car_zone_annotator.annotate(annotated_frame, line_counter=car_line_zone)
truck_zone_annotator.annotate(annotated_frame, line_counter=truck_line_zone)
# Just counting out
carlineoutcounter = car_line_zone.out_count
trucklineoutcounter = truck_line_zone.out_count
print("Car Count:", carlineoutcounter, "Truck Count:", trucklineoutcounter)
# Variable to write to the file
variable_in_wordswrite1 = "Cars Count"
variable_in_wordswrite2 = "Truck Count"
# Open a file in write this stuff a to append and write the stream w to just write the final result
with open("output.txt", "a") as file:
# Write the variable to the file
file.write(f"{variable_in_wordswrite1}: {carlineoutcounter}")
file.write(f"{variable_in_wordswrite2}: {trucklineoutcounter}")
Produces a stream like below:
(Using print so I can see what's happening but writes to the files a s well.
Car Count: 1 Truck Count: 1
Car Count: 1 Truck Count: 1
Car Count: 1 Truck Count: 2
Car Count: 1 Truck Count: 2
Car Count: 1 Truck Count: 2
Car Count: 2 Truck Count: 2
Car Count: 2 Truck Count: 2
Car Count: 3 Truck Count: 3
Car Count: 3 Truck Count: 3
Car Count: 3 Truck Count: 3
Car Count: 3 Truck Count: 4
Car Count: 3 Truck Count: 4
...... a lot more entries later
Car Count: 87 Truck Count: 23
Car Count: 87 Truck Count: 23
Car Count: 87 Truck Count: 23
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm separating out different classes with Yolo
For Example:
Then I have 2 lines to count the different classes, works fine, I can output the total with no issue.
Is it possible to write the time in video or perhaps only write it every x minutes for example to calculate the volume between entries?
Example code:
Produces a stream like below:
(Using print so I can see what's happening but writes to the files a s well.
Car Count: 1 Truck Count: 1
Car Count: 1 Truck Count: 1
Car Count: 1 Truck Count: 2
Car Count: 1 Truck Count: 2
Car Count: 1 Truck Count: 2
Car Count: 2 Truck Count: 2
Car Count: 2 Truck Count: 2
Car Count: 3 Truck Count: 3
Car Count: 3 Truck Count: 3
Car Count: 3 Truck Count: 3
Car Count: 3 Truck Count: 4
Car Count: 3 Truck Count: 4
...... a lot more entries later
Car Count: 87 Truck Count: 23
Car Count: 87 Truck Count: 23
Car Count: 87 Truck Count: 23
Beta Was this translation helpful? Give feedback.
All reactions