본문 바로가기

TIL

(7)
List comprehension vs. map List comprehension vs map Is there a reason to prefer using map() over list comprehension or vice versa? Is either of them generally more efficient or considered generally more Pythonic than the other? stackoverflow.com 람다 없이 같은 함수를 쓴다면 map이 조금 더 빠르고, 람다로 함수를 선언한다면 list comprehension이 조금 더 빠르다.
HDFS 휴지통 복구, HDFS 파일 복구, HDFS 폴더 복구 실수로 파일 삭제를 했을 때 휴지통에서 복구할 수 있는 방법을 소개한다. (왜냐면 내가 이런 적이 많거든 ..^^ㅠ) 간단하다. cp 명령어로 휴지통에 있는 파일/폴더를 복사해오면 된다. 그러면 휴지통 위치는 어떻게 알 수 있는가? 삭제 시 rm 명령어로 삭제했을텐데 친절하게도 휴지통이 어디에 있는지 알려준다. 나의 경우 폴더를 삭제했기 때문에 -r을 옵션으로 주었다. $ hdfs dfs -rm -r {삭제 전 폴더 위치} 22/07/21 15:23:59 INFO fs.TrashPolicyDefault: Moved: 'URI' to trash at: {삭제 후 휴지통에 있는 폴더 위치} 여기서 {삭제 후 휴지통에 있는 폴더 위치}를 다시 {삭제 전 폴더 위치}로 복사하면 된다. $ hdfs dfs -cp..
Conv1D, Conv2D, Conv3D 차이 말 그대로다. 1차원 배열 데이터에는 Conv1D를, 2차원 배열 데이터에는 Conv2D를 사용한다. 아직까지 Conv3D를 사용해 본 적은 없지만 마찬가지로 3차원 배열 데이터에 사용한다. 즉, Conv1D, Conv2D, Conv3D 차이는 입력 데이터의 차원이다. 그런데 여기서 끝나면 의문이 생긴다. 코드를 보자. model = tf.keras.models.Sequential([ # Note the input shape is the desired size of the image 150x150 with 3 bytes color tf.keras.layers.Conv2D(64, (3,3), activation='relu', input_shape=(150, 150, 3)), tf.keras.layers.M..
include_top의 의미 The inception V3 has a fully-connected layer at the top. So by setting include_top to false, you're specifying that you want to ignore this and get straight to the convolutions. -> top에 fully-connected layer가 있는 경우 include_top=False를 하면 무시하고 바로 convolution으로 가게 해 줌. 근데 fully-connected layer는 보통 bottom에 있지 top에 없지 않나? Tensorflow 공식문서에서 include_top 매개변수 설명을 찾아보니 whether to include the fully-connec..
입력 이미지(input image)를 정규화(normalize)하는 이유 As you may already know, data that goes into neural networks should usually be normalized in some way to make it more amenable to processing by the network. (It is uncommon to feed raw pixels into a convnet.) -> input image를 normalize하면 네트워크가 데이터를 처리하기가 더 쉬워진다고 합니다. 실제로 raw pixel을 그대로 CNN에 넣는 일은 드물다고 하네요. from tensorflow.keras.preprocessing.image import ImageDataGenerator # All images will be re..