Example #1
0
from DLTools.Permutator import *
import sys, argparse
from numpy import arange
import os

from multiprocessing import cpu_count
from DLTools.Utils import gpu_count

# Save location
saveFolder = "/home/mazhang/DLKit/CaloDNN/NeuralNets/Cache/Dense_GammaPi0_50Epochs/"
if not os.path.exists(os.path.dirname(saveFolder)):
    os.makedirs(os.path.dirname(saveFolder))

# Number of threads
max_threads = 12
n_gpu = gpu_count()
if n_gpu > 0:
    n_threads = int(min(round(cpu_count() / n_gpu), max_threads))
else:
    n_threads = max(1, cpu_count() - 2)
print "Found", cpu_count(), "CPUs and", gpu_count(
), "GPUs. Using", n_threads, "threads. max_threads =", max_threads

# Particle types
Particles = ["Gamma", "Pi0"]

# ECAL shapes (add dimensions for conv net)
ECALShape = None, 25, 25, 25
HCALShape = None, 5, 5, 60

# Input for mixing generator
import random
import getopt
from DLTools.Permutator import *
import sys, argparse
from numpy import arange
import os

from multiprocessing import cpu_count
from DLTools.Utils import gpu_count

max_threads = 12
n_threads = int(min(round(cpu_count() / gpu_count()), max_threads))
print "Found", cpu_count(), "CPUs and", gpu_count(
), "GPUs. Using", n_threads, "threads. max_threads =", max_threads

#Particles=["ChPi","Gamma","Pi0","Ele"]
Particles = ["Pi0", "Gamma"]

# Input for Mixing Generator
FileSearch = "/data/LCD/V2/MLDataset/*/*.h5"

# Generation Model
Config = {
    "MaxEvents": int(1.e5),
    "NTestSamples": 10000,
    "NClasses": len(Particles),
    "Epochs": 100,
    "BatchSize": 1024,

    # Configures the parallel data generator that read the input.
    # These have been optimized by hand. Your system may have