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
| # train/test 경로에 따른 이미지 파일 확인 | |
| # training image 폴더명 : 파일명 형태로 정리 | |
| train_file = {} | |
| val_file = os.listdir(validation_dir) | |
| for folder in os.listdir(train_dir): | |
| train_file[folder] = os.listdir(train_dir + folder) | |
| print(len(os.listdir(validation_dir))) | |
| print(os.listdir(train_dir)) |
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
| # 훈련 이미지 디렉토리 설정 | |
| base_dir = './tmp' | |
| train_dir = os.path.join(base_dir, 'train/train/') | |
| validation_dir = os.path.join(base_dir, 'test/test/0/') |
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
| # 다운로드 받은 이미지 압축 파일 해제 | |
| local_zip = './train.zip' | |
| zip_ref = zipfile.ZipFile(local_zip, 'r') | |
| zip_ref.extractall('tmp/train') | |
| zip_ref.close() | |
| local_zip = './test.zip' | |
| zip_ref = zipfile.ZipFile(local_zip, 'r') |
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
| !python --version | |
| # !pip install tensorflow-datasets==4.3.0 Pillow==8.2.0 pandas==1.2.4 | |
| # TF Certificate 권장 모듈 설정 | |
| import tensorflow as tf | |
| import tensorflow_datasets as tfds | |
| import pandas as pd | |
| import numpy as np | |
| import scipy | |
| import PIL | |
| # Tf Certificate 권장 모듈 끝 |
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
| # 파이썬 3.8.0으로 버전 변경하기 | |
| !wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz | |
| !tar xvfz Python-3.8.0.tgz | |
| !Python-3.8.0/configure | |
| !./configure | |
| !make | |
| !sudo make install | |
| !pip3 list | |
| !python --version |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| class HauntedBus: | |
| def __init__(self, passengers=None): | |
| if passengers is None: | |
| self.passengers = [] | |
| else: | |
| self.passengers = list(passengers) | |
| def pick(self, name): | |
| self.passengers.append(name) | |
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
| class HauntedBus: | |
| def __init__(self, passengers=[]): | |
| self.passengers = passengers | |
| def pick(self, name): | |
| self.passengers.append(name) | |
| def drop(self, name): | |
| self.passengers.remove(name) |
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
| class Gizmo: | |
| def __init__(self): | |
| print("Gizmo id: %d" % id(self)) | |
| x = Gizmo() | |
| # Gizmo id : 4301489152 | |
| y = Gizmo() * 10 | |
| # Gizmo id : 4301489432 |
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
| a = [1,2,3] | |
| b = a | |
| a.append(4) | |
| print(b) # result : [1,2,3,4] |