Skip to content

Instantly share code, notes, and snippets.

View danielcwq's full-sized avatar
🎯
Focusing

Daniel Ching danielcwq

🎯
Focusing
View GitHub Profile
from oauth2client.service_account import ServiceAccountCredentials
import gspread
import pytz
from datetime import datetime
import requests
import json
import time
import os
from datetime import datetime
Intensity Time To Exhaustion Rate of Perceived Exertion
Very Easy / Easy 5+ Hours 0-2
Easy/Moderate -> Moderate 3-4 Hours 3-4
Easy Tempo 2 Hours (Long Run Pace) 5
Tempo(LT1) 1 Hour / Marathon Pace (elites) 6
Threshold(LT2) 40-50 minutes/ Half-marathon pace (elites) 7
Critical Velocity(CV) 30-40 minutes 7.5-8
Aerobic Power 5k Race Pace (<20 minutes) 8-9
VO2Max 2.4k-3k Race Pace(5-8 minutes) 9
Anaerobic Endurance 1.5k to Mile Race Pace (4-6 minutes) 9.5
Intensity Ease of Talking Rate of Perceived Exertion
Very Easy / Easy Sustained Conversation (without shortness of breath) 0-2
Easy/Moderate -> Moderate Sustained Conversation (interspersed with deep breathing) 3-4
Easy Tempo Few phrases/ strung out sentences 5
Tempo(LT1) Few words 6
Threshold(LT2) Few words 7
Critical Velocity(CV) Hard to talk 7.5-8
Aerobic Power Unable to talk 8-9
VO2Max Unable to talk 9
Anaerobic Endurance Unable to talk 9.5
df.drop(df.index[2447:2500], inplace = True)
df.drop(df.index[3054:3080], inplace = True)
df.drop(df.index[3080:3108], inplace = True)
!kaggle datasets list -s ["Medical Transcriptions"]
!kaggle datasets download -d "tboyle10/medicaltranscriptions"
!unzip medicaltranscriptions.zip
from google.colab import files
files.upload()
!pip install -q kaggle
# The Kaggle API client expects this file to be in ~/.kaggle,
# so move it there.
!mkdir -p ~/.kaggle
!cp kaggle.json ~/.kaggle/
# This permissions change avoids a warning on Kaggle tool startup.
!chmod 600 ~/.kaggle/kaggle.json
x = dls.vocab
image = (path/'images/00000181_035.png') #some random image from the database
def match(raw, vocab):
return [[vocab[0],(raw[0].item()*100)],[vocab[1],(raw[1].item()*100)],[vocab[2],(raw[2].item()*100)],[vocab[3],(raw[3].item()*100)],[vocab[4],(raw[4].item()*100)],[vocab[5],(raw[5].item()*100)],[vocab[6],(raw[6].item()*100)],[vocab[7],(raw[7].item()*100)],[vocab[8],(raw[8].item()*100)],[vocab[9],(raw[9].item()*100)],[vocab[10],(raw[10].item()*100)],[vocab[11],(raw[11].item()*100)],[vocab[12],(raw[12].item()*100)],[vocab[13],(raw[13].item()*100)],[vocab[14],(raw[14].item()*100)]]
def list_preds(img_path):
prediction, indice, losses = learn.predict(img_path)
arr = match(losses, x)
return(arr)
list_preds(image)
def get_x(r): return path/'images'/r['Image Index']
def get_y(r): return r['Finding Labels'].split('|')
from google.colab import files
files.upload()
!ls -lha kaggle.json
!pip install -q kaggle --upgrade
# The Kaggle API client expects this file to be in ~/.kaggle,
# so move it there.
!mkdir -p ~/.kaggle
!cp kaggle.json ~/.kaggle/
# This permissions change avoids a warning on Kaggle tool startup.
valid_x = torch.cat([valid_2_tens, valid_9_tens]).view(-1, 28*28)
valid_y = tensor([1]*len(valid_2_tens) +[0]*len(valid_9_tens)).unsqueeze(1)
valid_dset = list(zip(valid_x,valid_y))