def main(): if len(sys.argv) < 4: print_usage() eval_name = sys.argv[1] metric_type = sys.argv[2] datasets = [] log_files = [] eval_errs = [] for idx in range(3, len(sys.argv), 2): dataset = sys.argv[idx] log_file = sys.argv[idx+1] datasets.append(dataset) log_files.append(log_file) print(dataset, log_file, eval_name, metric_type) if dataset=='rgbd': err = get_errors('fpad', log_file, 'test') else: err = get_errors(dataset, log_file, 'test') eval_errs.append(err) fig = plt.figure(figsize=(16, 6)) plt.figure(fig.number) draw_error_bar(eval_name, eval_errs, datasets, fig) draw_error_curve(eval_errs, datasets, metric_type, fig) plt.savefig('../figures/{}_error----.png'.format(metric_type)) plt.show()
def main(): if len(sys.argv) < 3: print_usage() dataset = sys.argv[1] in_file = sys.argv[2] errs = get_errors(dataset, in_file) draw_error(dataset, errs) draw_map(errs) plt.show()
def main(): if len(sys.argv) < 3: print_usage() dataset = sys.argv[1] metric_type = sys.argv[2] eval_names = [] eval_files = [] eval_errs = [] for idx in xrange(3, len(sys.argv), 2): in_name = sys.argv[idx] in_file = sys.argv[idx + 1] eval_names.append(in_name) eval_files.append(in_file) err = get_errors(dataset, in_file) eval_errs.append(err) fig = plt.figure(figsize=(16, 6)) plt.figure(fig.number) draw_error_bar(dataset, eval_errs, eval_names, fig) #plt.savefig('figures/{}_error_bar.png'.format(dataset)) draw_error_curve(eval_errs, eval_names, metric_type, fig) plt.savefig('figures/{}_error.png'.format(dataset)) # msra viewpoint if dataset == 'msra': fig2 = plt.figure(figsize=(16, 6)) plt.figure(fig2.number) # see https://github.com/xinghaochen/region-ensemble-network/blob/master/evaluation/get_angle.py # for how to calculate yaw and pitch angles for MSRA dataset msra_viewpoint = get_msra_viewpoint( 'groundtruth/{}/{}_angle.txt'.format(dataset, dataset)) # yaw draw_viewpoint_error_curve(dataset, eval_errs, eval_names, msra_viewpoint, 0, fig2) #plt.savefig('figures/{}_yaw.pdf'.format(dataset)) # pitch draw_viewpoint_error_curve(dataset, eval_errs, eval_names, msra_viewpoint, 1, fig2) plt.savefig('figures/{}_yaw_pitch.png'.format(dataset)) plt.show()
def main(): if len(sys.argv) < 3: print_usage() dataset = sys.argv[1] metric_type = sys.argv[2] eval_names = [] eval_files = [] eval_errs = [] for idx in xrange(3, len(sys.argv), 2): in_name = sys.argv[idx] in_file = sys.argv[idx+1] eval_names.append(in_name) eval_files.append(in_file) err = get_errors(dataset, in_file) eval_errs.append(err) draw_error(dataset, eval_errs, eval_names) draw_map(eval_errs, eval_names, metric_type) plt.show()
def post(self, request, format=None): form = ShortClientForm(request.POST) if not form.is_valid(): return Response({'errors': get_errors(form)[0]}) self.get_initial_data() self.user.first_name, self.user.last_name = get_name( form.cleaned_data['first_name']) self.user.save() client = self.user.client if form.cleaned_data['about']: client.about = form.cleaned_data['about'] client.save() if form.cleaned_data['location']: location = Location(title=form.cleaned_data['location'], address_line1=form.cleaned_data['location']) location.google_maps_request(force=True) location.save() ClientLocation.objects.create(client=client, location=location) return Response({'url': request.POST.get('next_url', '')})
def main(): if len(sys.argv) < 3: print_usage() dataset = sys.argv[1] metric_type = sys.argv[2] eval_names = [] eval_files = [] eval_errs = [] for idx in xrange(3, len(sys.argv), 2): in_name = sys.argv[idx] in_file = sys.argv[idx + 1] eval_names.append(in_name) eval_files.append(in_file) err = get_errors(dataset, in_file) eval_errs.append(err) draw_error_bar(dataset, eval_errs, eval_names) #plt.savefig('figures/{}_error_bar.png'.format(dataset)) draw_error_curve(eval_errs, eval_names, metric_type) plt.savefig('figures/{}_error.png'.format(dataset)) plt.show()
def post(self, request, format=None): def get_signup_form_class(): if signup_type == 'client': if no_name: return ClientSignupNoNameForm return ClientSignupForm elif signup_type == 'healer': return HealerSignupForm elif signup_type == 'wellness_center': return WellnessCenterSignupForm def process_form(): """Returns: user, signup_message, redirect_url.""" user = form.save(next=request.session.pop('signup_next', ''), is_superuser=is_superuser, cookies=request.COOKIES) # Add to unapproved clients healer_username = request.session.pop('signup_healer', '') if healer_username: try: healer_user = User.objects.get( username__iexact=healer_username) invite_or_create_client_friendship( client_user=user, healer_user=healer_user, send_client_request_email=False) except User.DoesNotExist: pass if is_superuser: message = 'User %s has been successfully created.' % user.get_full_name( ) return user, message, None # Meant to resolve #964 try: email = EmailAddress.objects.get(user=user) # added DGL except EmailAddress.DoesNotExist: # user = User.objects.filter(first_name=form.cleaned_data["first_name"], # last_name=form.cleaned_data["last_name"]).order_by('-date_joined')[0] email = EmailAddress.objects.create(user=user, email=user.email, verified=False, primary=True) EmailConfirmation.objects.send_confirmation(email) set_signup_source(user, self.request, is_phonegap) # get for phonegap backward compatibility: post_signup_processing(user, qd.get('is_ambassador', 0) == '1', request.session) if settings.ACCOUNT_EMAIL_VERIFICATION and not email.verified: if signup_type != 'client' and not is_phonegap: form.login(request, user) return user, None, None else: form.login(request, user) return user, None, reverse('what_next') def get_url(): if is_phonegap: if 'next_url' in qd: return qd['next_url'] else: return 'signup_thanks_%s.html' % signup_type thanks_url = reverse('signup_thanks', args=[signup_type]) plugin_value = qd.get(PLUGIN_KEY, False) if plugin_value: return '{}?{}={}'.format(thanks_url, PLUGIN_KEY, plugin_value) return thanks_url try: data = request.POST['data'].encode('utf-8') is_phonegap = json.loads(request.POST['is_phonegap']) except: return HttpResponseBadRequest() qd = QueryDict(data) signup_type = qd['type'] no_name = qd.get('no_name', False) form_class = get_signup_form_class() is_superuser = qd.get('is_superuser', False) if is_superuser: if not request.user.is_superuser: raise Http404 form = form_class(qd) if form.is_valid(): user, thanks_message, redirect_url = process_form() if redirect_url is not None: return Response({'redirect_url': redirect_url}) if form_class != ClientSignupForm: ctx_email = { "first_name": user.first_name, "last_name": user.last_name, "email": user.email, "username": user.username, "provider_url": ''.join( [get_current_site(request).domain, '/', user.username]) } send_hs_mail('New Provider', "admin/new_provider_message.txt", ctx_email, settings.DEFAULT_FROM_EMAIL, settings.EMAIL_ON_SIGNUP) if is_superuser: message = render_to_string('about/thanks.html', { 'thanks_message': thanks_message, 'thanks_title': 'Success' }) return Response({'message': message}) return Response({'url': get_url(), 'email': user.email}) errors, error_elements, error_list_pg_bc = get_errors(form) return Response({ 'errors': errors, 'error_elements': error_elements, 'error_list': error_list_pg_bc }) # error_list_pg_bc for pg backward compatibility
def post(self, request, format=None): try: data = request.POST['data'].encode('utf-8') source = request.POST.get('source', None) except: return HttpResponseBadRequest() if request.user.is_authenticated(): form = ComposeForm(QueryDict(data)) if form.is_valid(): sender = str(request.user.client) lines = [] lines.append("From: %s" % sender) lines.append("Email: %s" % request.user.email) lines.append("") lines.append("Subject: %s" % form.cleaned_data['subject']) lines.append("") lines.append(form.cleaned_data['body']) message = "\n".join(lines) ctx = { "SITE_NAME": settings.SITE_NAME, "sender": sender, "message": message, "reply_url": absolute_url(reverse('messages_inbox')) } subject = render_to_string("account/emails/send_message_unregistered_subject.txt", ctx) send_hs_mail(subject, "account/emails/send_message_unregistered_body.txt", ctx, settings.DEFAULT_FROM_EMAIL, [form.cleaned_data['recipient'][0].email]) else: qd = QueryDict(data) try: recipient = Healer.objects.get(user__username__iexact=qd['recipient_username']) except Healer.DoesNotExist: return form = ComposeFormUnregistered(qd) form.recipient = recipient.user.email if form.is_valid(): m = form.save(sender=request.user) if source: MessageExtra.objects.create(message=m[0], source=source) # request.user.message_set.create( # message=_(u"Message successfully sent.")) # success_url = reverse('messages_inbox') # if request.GET.has_key('next'): # success_url = request.GET['next'] #update captcha challenge, captcha_response = captcha_settings.get_challenge()() store = CaptchaStore.objects.create(challenge=challenge, response=captcha_response) errors, error_elements, _ = get_errors(form) return Response({'errors': errors, 'error_elements': error_elements, 'captcha': { 'img': reverse('captcha-image', kwargs=dict(key=store.hashkey)), 'code': store.hashkey}})
def main(): dataset = 'msra' metric_type = 'max-frame' eval_errs = [] ### MSRA eval_names = ['ResNet-Hand', '3DCNN', 'Multi-Region', 'Pose-Guide'] eval_files = [ dir + 'results/msra/JVCI18_MSRA_REN_9x6x6.txt', dir + 'results/msra/CVPR17_MSRA_3DCNN.txt', dir + 'results/msra/NEUCOM18_MSRA_Pose_REN.txt', dir + 'results/msra/xzz.txt' ] # ### ICVL # eval_names = ['LRF', 'DeepModel', 'Guo_Baseline', # 'ResNet-Hand', 'Multi-Region ', # 'Pose-Guide'] # # eval_files = [dir + 'results/icvl/CVPR14_LRF_Results.txt', # dir + 'results/icvl/IJCAI16_ICVL_DeepModel.txt', # dir + 'results/icvl/ICIP17_ICVL_Guo_Basic.txt', # dir + 'results/icvl/ICIP17_ICVL_REN_4x6x6.txt', # dir + 'results/icvl/JVCI18_ICVL_REN_9x6x6.txt', # # dir + 'results/icvl/NEUCOM18_ICVL_Pose_REN.txt', # dir + 'results/icvl/xzz.txt'] # ### NYU # eval_names = ['DeepPrior', 'DeepPrior-Refine', 'DeepModel', 'Feedback', # 'Guo_Basic', 'LieX', '3DCNN', 'ResNet-Hand', # 'Multi-Region', 'Pose-Guide'] # # eval_files = [dir + 'results/nyu/CVWW15_NYU_Prior.txt', # dir + 'results/nyu/CVWW15_NYU_Prior-Refinement.txt', # dir + 'results/nyu/IJCAI16_NYU_DeepModel.txt', # dir + 'results/nyu/ICCV15_NYU_Feedback.txt', # dir + 'results/nyu/ICIP17_NYU_Guo_Basic.txt', # dir + 'results/nyu/IJCV16_NYU_LieX.txt', # dir + 'results/nyu/CVPR17_NYU_3DCNN.txt', # dir + 'results/nyu/ICIP17_NYU_REN_4x6x6.txt', # # dir + 'results/nyu/JVCI18_NYU_REN_9x6x6.txt', # dir + 'results/nyu/ICCVW17_NYU_DeepPrior++.txt', # # dir + 'results/nyu/NEUCOM18_NYU_Pose_REN.txt', # dir + 'results/nyu/xzz.txt'] for in_file in eval_files: err = get_errors(dataset, in_file) eval_errs.append(err) fig = plt.figure(figsize=(14, 6)) plt.figure(fig.number) draw_error_bar(dataset, eval_errs, eval_names, fig) # plt.savefig('figures/{}_error_bar.png'.format(dataset)) draw_error_curve(eval_errs, eval_names, metric_type, fig) plt.savefig(dir + 'figures/{}_error.svg'.format(dataset), dpi=300) # msra viewpoint if dataset == 'msra': fig2 = plt.figure(figsize=(14, 6)) plt.figure(fig2.number) # see https://github.com/xinghaochen/region-ensemble-network/blob/master/evaluation/get_angle.py # for how to calculate yaw and pitch angles for MSRA dataset msra_viewpoint = get_msra_viewpoint( dir + 'groundtruth/{}/{}_angle.txt'.format(dataset, dataset)) # yaw draw_viewpoint_error_curve(dataset, eval_errs, eval_names, msra_viewpoint, 0, fig2) # plt.savefig('figures/{}_yaw.pdf'.format(dataset)) # pitch draw_viewpoint_error_curve(dataset, eval_errs, eval_names, msra_viewpoint, 1, fig2) plt.savefig(dir + 'figures/{}_yaw_pitch.svg'.format(dataset), dpi=300) plt.show()