Exemple #1
0
    def get_loss(self, data):

        with StopWatch("data preparation"):
            d = self.feed(data, use_labels=True)
        with StopWatch("network"):
            return self.session.run(
                ((self.premsel_loss, self.premsel_tpr, self.premsel_tnr),
                 (self.symbol_loss,
                  self.symbol_accuracy), self.premsel_num, self.symbol_num), d)
 def __init__(self, video_length, segment_duration,connectionType):
     config_dash.LOG.info("Initializing the Buffer")
     self.player_thread = None
     self.playback_start_time = None
     self.playback_duration = video_length
     self.segment_duration = segment_duration
     # Timers to keep track of playback time and the actual time
     self.playback_timer = StopWatch()
     self.actual_start_time = None
     # Playback State
     self.playback_state = "INITIALIZED"
     self.playback_state_lock = threading.Lock()
     # Buffer size
     if config_dash.MAX_BUFFER_SIZE:
         self.max_buffer_size = config_dash.MAX_BUFFER_SIZE
     else:
         self.max_buffer_size = video_length
     # Duration of the current buffer
     self.buffer_length = 0
     self.buffer_length_lock = threading.Lock()
     # Buffer Constants
     self.initial_buffer = config_dash.INITIAL_BUFFERING_COUNT
     self.alpha = config_dash.ALPHA_BUFFER_COUNT
     self.beta = config_dash.BETA_BUFFER_COUNT
     self.segment_limit = None
     # Current video buffer that holds the segment data
     self.buffer = Queue.Queue()
     self.buffer_lock = threading.Lock()
     self.current_segment = None
     self.buffer_log_file = config_dash.BUFFER_LOG_FILENAME +"_"+connectionType+".csv"
     config_dash.LOG.info("VideoLength={},segmentDuration={},MaxBufferSize={},InitialBuffer(secs)={},"
                          "BufferAlph(secs)={},BufferBeta(secs)={}".format(self.playback_duration,
                                                                           self.segment_duration,
                                                                           self.max_buffer_size, self.initial_buffer,
                                                                           self.alpha, self.beta))
Exemple #3
0
 def __init__(self, video_length, segment_duration):
     config_dash.LOG.info("Initializing the Buffer")
     #modification by Arslan for MongoClient IP of the mininet vm 192.168.56.103
     self.dbclient = MongoClient('192.168.56.103', 27017)
     # Read description above
     self.db = self.dbclient.qoemonitor.qoe
     self.dbqoemetric = self.dbclient.qoemonitor.qoemetric
     self.dbqoefrequency = self.dbclient.qoemonitor.qoefrequency
     """modification by Arslan to store action and bitrate as Variables"""
     self.Action_store = ""
     self.Bitrates_store = 0
     self.monitor = None
     """modification above"""
     self.player_thread = None
     self.playback_start_time = None
     self.playback_duration = video_length
     self.segment_duration = segment_duration
     #print "video_length = {}".format(video_length)
     #print "segment_duration = {}".format(segment_duration)
     # Timers to keep track of playback time and the actual time
     self.playback_timer = StopWatch()
     self.actual_start_time = None
     # Playback State
     self.playback_state = "INITIALIZED"
     self.playback_state_lock = threading.Lock()
     # Buffer size
     if config_dash.MAX_BUFFER_SIZE:
         self.max_buffer_size = config_dash.MAX_BUFFER_SIZE
     else:
         self.max_buffer_size = video_length
     # Duration of the current buffer
     self.buffer_length = 0
     self.buffer_length_lock = threading.Lock()
     # Buffer Constants
     self.initial_buffer = config_dash.INITIAL_BUFFERING_COUNT
     self.alpha = config_dash.ALPHA_BUFFER_COUNT
     self.beta = config_dash.BETA_BUFFER_COUNT
     self.segment_limit = None
     # Current video buffer that holds the segment data
     self.buffer = Queue.Queue()
     self.buffer_lock = threading.Lock()
     self.current_segment = None
     self.buffer_log_file = config_dash.BUFFER_LOG_FILENAME
     """modification by Arslan to collect qoe metrics """
     self.stalling = 0
     self.qoe_log_file = config_dash.QOE_LOG_FILENAME
     config_dash.LOG.info(
         "VideoLength={},segmentDuration={},MaxBufferSize={},InitialBuffer(secs)={},"
         "BufferAlph(secs)={},BufferBeta(secs)={}".format(
             self.playback_duration, self.segment_duration,
             self.max_buffer_size, self.initial_buffer, self.alpha,
             self.beta))
Exemple #4
0
    async def valid_command(self, message: discord.Message,
                            user: discord.Client.user):
        """
        メッセージがコマンドとして入力された場合、実行される
        """
        user_order = message.content[1:].split()
        command = user_order[0]
        other_order = user_order[1:]
        print("from:    {}\ncommand: {}".format(message.author, user_order))
        if command == "help":
            await message.channel.send(INTRODUCTION)
            return

        if command == "timer":
            if len(user_order) < 2:
                await message.channel.send("<@!{}>\n入力エラー".format(
                    message.author.id))
                return

            index = -1

            for i in range(len(self.stop_watch_list)):
                sw = self.stop_watch_list[i]
                if message.author.id == sw.user_id:
                    index = i
                    break
            if index == -1:
                self.stop_watch_list.append(StopWatch(message.author.id))
                index = len(self.stop_watch_list) - 1

            await self.stop_watch_list[index].call_stop_watch(
                user_order[1], message.channel)
            return

# TODO
        if command == "status":
            if len(user_order) < 2 or user_order[1][1] != "@":
                await message.channel.send(user.mention + "\n入力エラー")
                return
            mentioned_user_id = user_order[1][3:-1]
            for guild_user in message.guild.members:
                if mentioned_user_id == str(guild_user.id):
                    await message.channel.send("ユーザーID: {} の状態は {} です".format(
                        mentioned_user_id, guild_user.status))
                    return
            await message.channel.send(user.mention + "\nそんな人ここにはいないです")
            print(message.content)
            return
Exemple #5
0
 def setUp(self):
     self.stopwatch = StopWatch()
Exemple #6
0
 def predict(self, data):
     with StopWatch("data preparation"):
         d = self.feed(data, use_labels=False)
     with StopWatch("network"):
         return self.session.run(self.premsel_predictions,
                                 self.symbol_predictions, d)
Exemple #7
0
                symbol_to_num[symbol]
                for symbol in truncate_skolem(funcs + rels)
            ]
            res_data.append((graph_data, (lens, labels, symbols)))
        res.append(res_data)
    return res


if __name__ == "__main__":
    import traceback_utils
    import sys

    # hide entrails of Tensorflow in error messages
    sys.excepthook = traceback_utils.shadow('/home/mirek/.local/')

    with StopWatch("loading data"):

        print("Loading data...")
        sys.stdout.flush()
        #test_data, train_data = load_data("deepmath/nndata2")
        #test_data, train_data = load_data("bartosz/nndata/test", "bartosz/nndata/train")
        test_data, train_data = load_data(
            "enigma-2019-10/all-mzr02/test_sng",
            "enigma-2019-10/all-mzr02/train_sng")
        print("Enumerate symbols...")
        symbol_to_num, test_data, train_data = enumerate_symbols(
            test_data, train_data)
        #total_symbols = len(symbol_to_num)
        #print("{} symbols".format(total_symbols))
        print("Constructing network...")
        sys.stdout.flush()