Beispiel #1
0
def train_all_page(request):
    if 'imdb_id' in request.GET and request.GET['imdb_id']:
        imdb_id=request.GET['imdb_id']
        mface_utils=face_utils.face_utils()
        mface_utils.set_temp_path('/home/volcan/Desktop/development/FlyingCircus/WebServer/media/actors/') #Should come from some static_root
        picture_index=mface_utils.image_indices_from_imdb_id(imdb_id)
        mface_utils.train_all()
        picture_index=mface_utils.predict_all_labels(picture_index)
        return render_to_response("imdb_training/training_result_page.html",{'images_index':picture_index,'imdb_id':imdb_id},context_instance = RequestContext(request))
    else: return HttpResponse("could not render this, are we missing ?imdb_id=...")
Beispiel #2
0
def actor_page(request):    
    mimdb_utils=imdb_utils.imdb_utils()
    mface_utils=face_utils.face_utils()
    if 'imdb_id' in request.GET and request.GET['imdb_id']:
        mimdb_utils.set_temp_path('/home/volcan/Desktop/development/FlyingCircus/WebServer/media/actors/') #Should come from some static_root
        mface_utils.set_temp_path('/home/volcan/Desktop/development/FlyingCircus/WebServer/media/actors/') #Should come from some static_root
        imdb_id=request.GET['imdb_id']
        picture_index=mimdb_utils.download_all_images(imdb_id) #Populate with original images
        picture_index=mface_utils.extract_from_index(picture_index) # Populate with faces images
        return render_to_response("imdb_training/actor_page.html",{'images_index':picture_index,'imdb_id':imdb_id,}, context_instance = RequestContext(request))
    else: return HttpResponse("could not render this, are we missing ?imdb_id=...")
Beispiel #3
0
def update_positives(request):
    if request.method=='POST':
        imdb_id=request.POST['imdb_id']
        mface_utils=face_utils.face_utils()
        mface_utils.set_temp_path('/home/volcan/Desktop/development/FlyingCircus/WebServer/media/actors/') #Should come from some static_root
        picture_index=mface_utils.image_indices_from_imdb_id(imdb_id)
        selected=[]
        for i in request.POST:
            if i.startswith("face"): 
                selected.append(request.POST[i])
        picture_index=mface_utils.set_positives(picture_index,selected)
        mface_utils.save_image_indices(picture_index,imdb_id)
        
        #model=mface_utils.lbph_train(picture_index,selected)
        #picture_index=mface_utils.label_confidence(model,picture_index)
        return render_to_response("imdb_training/update_positives_page.html",{'images_index':picture_index,'imdb_id':imdb_id,'selected':selected}, context_instance = RequestContext(request))
#        html=[]
#        for i in request.POST:
#            html.append(i+"  -  "+request.POST[i]+"<br/>")
#        return HttpResponse('%s' % '\n'.join(html))
    else:
        return HttpResponse("Not a post...")