コード例 #1
0
 def __get_inception(self):
     model = models.inception_v3(pretrained=True)
     for param in model.parameters():
         param.requires_grad = False
     self.architecture["input"] = model.fc.in_features
     model.classifier = Network(self.architecture)
     return model
コード例 #2
0
 def __get_densenet121(self):
     model = models.densenet121(pretrained=True)
     for param in model.parameters():
         param.requires_grad = False
     self.architecture["input"] = model.classifier.in_features
     model.classifier = Network(self.architecture)
     return model
コード例 #3
0
 def __get_vgg16(self):
     model = models.vgg16(pretrained=True)
     for param in model.parameters():
         param.requires_grad = False
     self.architecture["input"] = model.classifier[0].in_features
     # TODO: Validate classifier architecture?
     model.classifier = Network(self.architecture)
     return model
コード例 #4
0
ファイル: boot.py プロジェクト: mj3c/crowdnav-kafka
def start():
    """ main entry point into the application """
    info('#####################################', Fore.CYAN)
    info('#      Starting CrowdNav v0.2       #', Fore.CYAN)
    info('#####################################', Fore.CYAN)
    info('# Configuration:', Fore.YELLOW)
    info('# Kafka-Host   -> ' + Config().kafka_endpoint, Fore.YELLOW)
    info('# Kafka-Topic-Trips -> ' + Config().kafka_topic_trips, Fore.YELLOW)
    info('# Kafka-Topic-Performance -> ' + Config().kafka_topic_performance, Fore.YELLOW)
    info('# Kafka-Topic-TL-Status -> ' + Config().kafka_topic_tl_status, Fore.YELLOW)

    if Config().sumo_random_seed != -1:
        random.seed(Config().sumo_random_seed)

    # init sending updates to kafka and getting commands from there
    Consumer.init()
    Producer.init()

    # Check if sumo is installed and available
    sumo_dependency.check_deps()
    info('# SUMO-Dependency check OK!', Fore.GREEN)

    # Load the sumo map we are using into Python
    Network.load()
    info(Fore.GREEN + "# Map loading OK! " + Fore.RESET)
    info(Fore.CYAN + "# Nodes: " + str(Network.nodes_count()) + " / Edges: " + str(Network.edges_count()) + Fore.RESET)

    # After the network is loaded, we init the router
    CustomRouter.init()
    # Start sumo in the background
    sumo_connector.start()
    info("\n# SUMO-Application started OK!", Fore.GREEN)
    # Start the simulation
    Simulation.start()
    # Simulation ended, so we shutdown
    info(Fore.RED + '# Shutdown' + Fore.RESET)
    traci.close()
    sys.stdout.flush()
    return None