Skip to content

Commit

Permalink
fix imports
Browse files Browse the repository at this point in the history
  • Loading branch information
yk220284 committed May 11, 2021
1 parent acb77d5 commit d55f9e4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
15 changes: 5 additions & 10 deletions Auto_Encoder_detector.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
from pycocotools.coco import COCO
import cv2
import json
import numpy as np
import os

import cv2
import numpy as np
import tensorflow as tf
from pycocotools.coco import COCO
from tqdm import tqdm

tf.keras.backend.clear_session()
from tensorflow.keras.layers import Conv2D, Conv2DTranspose, \
Dense, Reshape, InputLayer, Flatten

from alibi_detect.od import OutlierAE
from alibi_detect.utils.saving import save_detector, load_detector
from crop_utils import batch_crop_images, view_annotation
from crop_utils import batch_crop_images

from anomaly_detector import create_destination

Expand Down Expand Up @@ -122,11 +122,6 @@ def detect_anomalies_auto_encoder(annotation_path, images_path, intermediate_rlt
od.fit(X_train,
epochs=30)

# save the trained outlier detector
save_detector(od, model_path)

od = load_detector(model_path)

resized_test = np.reshape(X_train_ls, (len(X_train_ls), 32, 32, 3))
res = od.predict(resized_test)

Expand Down
4 changes: 2 additions & 2 deletions Manually_based_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
from sklearn.neighbors import LocalOutlierFactor
from sklearn.preprocessing import StandardScaler

#from anomaly_analysis.anomaly_feature_extraction import get_roughness, get_histograms, \
#get_obj_colors, get_proportion
from anomaly_analysis.anomaly_feature_extraction import get_roughness, get_histograms, \
get_obj_colors, get_proportion


def combine_feature_dataset(annotation_file, img_folder, intermediate_rlt_path, cat_name=[]):
Expand Down
2 changes: 1 addition & 1 deletion hog_based_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from sklearn.ensemble import IsolationForest
from sklearn.neighbors import LocalOutlierFactor

#from anomaly_analysis.anomaly_feature_extraction import get_HOG
from anomaly_analysis.anomaly_feature_extraction import get_HOG
from anomaly_detector import create_destination
from crop_utils import batch_crop_images

Expand Down

0 comments on commit d55f9e4

Please sign in to comment.