기본 콘텐츠로 건너뛰기

피클파일저장및읽기

pickle 라이브러리를 이용하여 데이터 저장 및 읽기

tmp1에 어떤 데이터가 저장되어있다.
numpy와 array형태로 저장되어있는 데이터에서 테스트했다.

import pickle
#savesave_file = open('test.pickle', 'wb')
pickle.dump(tmp,save_file)
save_file.close()
#readread_file = open('test.pickle','rb')
tmp2 = pickle.load(read_file)
read_file.close()

댓글

이 블로그의 인기 게시물

데이터 열로 추가하여 쌓기

import numpy as np x = [] a = np.array([1,2,3]) Out[5]: array([1, 2, 3]) a.shape Out[6]: (3,) np.concatenate((x,a)) Out[7]: array([ 1.,  2.,  3.]) x = np.concatenate((x,a)) x = np.concatenate((x,a)) Out[10]: array([ 1.,  2.,  3.,  1.,  2.,  3.]) x = [] x = np.concatenate((x,a), axis=1) => 오류발생  -. x가 차원이 안맞아서 안됨.  np.expand_dims(a,axis=1) Out[14]:  array([[1],        [2],        [3]]) b = np.expand_dims(a,axis=1) b.shape Out[16]: (3, 1) => (3,1)짜리 차원으로 확장한 후 열 방향으로 쌓을 수 있다. => 아래는 empty함수나 zeros를 사용하여 공간을 만드는 작업 x = [] x = np.empty((3,0)) x Out[19]: array([], shape=(3, 0), dtype=float64) x = np.zeros((3,0)) x Out[21]: array([], shape=(3, 0), dtype=float64) x = np.zeros((3,0)) a Out[23]: array([1, 2, 3]) b Out[24]: array([[1],        [2],        [3]]) np.concatenate((x,b), axis=1) Out[26]: array([[ 1.], ...

HTML 테스트

Lab 시리즈 화장품 구매(파란색, 가장크게) <span style="color: blue; font-size: x-large;">Lab 시리즈 화장품 구매(파란색, 가장크게)</span><br /> Lab 시리즈 화장품 구매(검은색, 보통) <span style="color: blue; font-size: x-large;"><br /></span> Lab 시리즈 화장품 구매(검은색, 보통)<br /> Lab 시리즈 화장품 구매(검은색, 보통, Airal) <span style="font-family: Arial, Helvetica, sans-serif;">Lab 시리즈 화장품 구매(검은색, 보통, Airal)</span><br /> Lab 시리즈 화장품 구매(검은색, 보통, Airal, Bold) <span style="font-family: Arial, Helvetica, sans-serif;"><b>Lab 시리즈 화장품 구매(검은색, 보통, Airal, Bold)</b></span> 하나의 문단을 의미하는 <p>태그 문장의 일부를 의미하는 <span>태그 강제줄바꿈을 의미하는 <br>태그 비교적 넓은 지역을 묶어 지정 </div>

keras를 이용하여 cifar10 실행해보기 (Functional API step by step)

Keras 라이브러리를 이용하여 cifar 10 데이터를 기본적인 CNN 구조를 이용하여 수행 사용하는 레이어들을 추가한다. from keras.layers import Input, Dense, Dropout, Activation, Flatten from keras.layers import Conv2D, MaxPooling2D 모델도 추가한다. from keras.models import Model 구조는 기본적으로 아래와 같다. 이는 keras에서 제공하는 cifar10 예제를 참고하였다. conv2D -> conv2D -> maxpooling -> dropout -> conv2D -> conv2D -> maxpooling -> dropout -> flatten -> Dense -> dropout ->Dense(마지막은 분류하고자 하는 개수, 여기서는 10) 블럭을 생성하기 전에 Input layer에 형태를 넣어줘야한다. #Input inputs =Input((32,32,3)) # block1 x = Conv2D(32, (3,3), activation='relu', padding='same', name='block1_conv1')(inputs)  x = Conv2D(32, (3,3), activation='relu', padding='valid', name='block1_conv2')(x)  x = MaxPooling2D((2, 2), name='block1_pool')(x) x = Dropout(0.25)(x)  # block2 x = Conv2D(64, (3,3), activation='relu', padding='same', name='block2_conv1')...