Skip to main content
. 2024 Sep 30;14(19):2828. doi: 10.3390/ani14192828
Algorithm 1: Pseudo-code of pig behavior analysis.
Input: A video sequence V; object detector Det; tracking score threshold η is set 0.75;
Frames per second Fps;
Output: Tracks T of the video
  • 1

    Initialization: T

  • 2

    for frame fk in V do

  • 3

    DDetfk

  • 4

     Initialize time-count array including four elements for time statistics a0,0,0,0

  • 5

     Set variable category_indexDcategory

  • 6

    acategory_index1

  • 7

     Associate T with D using OC-SORT:

  • 8

      if succeed to match then

  • 9

       Call the update or re-activate function to update the status of tracks

  • 10

       Set variable ATcategory_time_array+a

  • 11

       Tcategory_time_arrayA

  • 12

      end

  • 13

      if D failed to match and D>η then

  • 14

       Call the function to create a new track.

  • 15

       Initialize time-count array A0,0,0,0

  • 16

       Tcategory_time_arrayA

  • 17

      end

  • 18

    End

  • 19

    Tcategory_time_array=Tcategory_time_array/Fps

Return T