Exemplo n.º 1
0
# The detail network setting
opt = parser.parse_args()
print(opt)

# Save all the codes
os.system('mkdir %s' % opt.experiment)
os.system('cp *.py %s' % opt.experiment)

if torch.cuda.is_available() and opt.noCuda:
    print(
        "WARNING: You have a CUDA device, so you should probably run with --cuda"
    )

# Initialize network
net = faceNet.faceNet(m=opt.marginFactor, feature=False)
lossLayer = faceNet.CustomLoss(s=opt.scaleFactor)

# Move network and containers to gpu
if not opt.noCuda:
    net = net.cuda(opt.gpuId)

# Initialize optimizer
optimizer = optim.SGD(net.parameters(),
                      lr=opt.initLR,
                      momentum=0.9,
                      weight_decay=5e-4)

# Initialize dataLoader
faceDataset = dataLoader.BatchLoader(imageRoot=opt.imageRoot,
                                     alignmentRoot=opt.alignmentRoot,
                                     cropSize=(opt.imWidth, opt.imHeight))
Exemplo n.º 2
0
# The detail network setting
opt = parser.parse_args()
print(opt)

# Save all the codes
os.system('mkdir %s' % opt.experiment)
os.system('cp *.py %s' % opt.experiment)

if torch.cuda.is_available() and opt.noCuda:
    print(
        "WARNING: You have a CUDA device, so you should probably run with --cuda"
    )

# Initialize network
net = faceNet.faceNet(m=opt.marginFactor, feature=False)
lossLayer = faceNet.CustomLoss()

# Move network and containers to gpu
if not opt.noCuda:
    net = net.cuda(opt.gpuId)

# Initialize optimizer
optimizer = optim.SGD(net.parameters(),
                      lr=opt.initLR,
                      momentum=0.9,
                      weight_decay=5e-4)

# Initialize dataLoader
faceDataset = dataLoader.BatchLoader(imageRoot=opt.imageRoot,
                                     alignmentRoot=opt.alignmentRoot,
                                     cropSize=(opt.imWidth, opt.imHeight))