This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | def calc_bias(a, b, theta): | |
| ''' | |
| Args: | |
| a: (real), long axis in ellipse | |
| b: (real), short axis in ellipse | |
| theta: (real), line slope [0, pi), anticlockwise | |
| Returns: | |
| x,y: tangent line point in first quadrant | |
| ''' | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import cv2 | |
| import math | |
| import numpy as np | |
| def affine(path, theta, scalex): | |
| img = cv2.imread(path) | |
| h, w, c = img.shape | |
| x0 = w // 2 | |
| y0 = h // 2 | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import tensorflow as tf | |
| def map_func_single(example): | |
| feature_dict = { | |
| "url": tf.FixedLenFeature(1, tf.string), | |
| "pic_data": tf.FixedLenFeature(1, tf.string), | |
| "dt": tf.FixedLenFeature(1, tf.string), | |
| "pic_size": tf.FixedLenFeature(1, tf.int64), | |
| "origin_pic_width": tf.FixedLenFeature(1, tf.int64), | |
| "origin_pic_height": tf.FixedLenFeature(1, tf.int64), | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #include <cuda_runtime_api.h> | |
| #include <cuda.h> | |
| #include <stdio.h> | |
| int main() | |
| { | |
| cudaDeviceProp prop; | |
| int gpu_index = 0; | |
| int i = 0; | |
| cudaGetDeviceProperties(&prop, gpu_index); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import sys | |
| import logging | |
| # logging.basicConfig() | |
| log = logging.getLogger(__name__) | |
| log.setLevel(logging.INFO) | |
| handler = logging.StreamHandler(sys.stdout) | |
| log.addHandler(handler) | |
| formatter = logging.Formatter(f'%(asctime)s %(levelname)s:%(name)s: %(message)s', datefmt='%m/%d/%Y %H:%M:%S') | |
| handler.setFormatter(formatter) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import os | |
| os.environ['CUDA_VISIBLE_DEVICES']='7' | |
| import sys | |
| import time | |
| import copy | |
| import torch | |
| import numpy as np | |
| import gradio as gr | |
| from PIL import Image |