Spaces:
Sleeping
Sleeping
altawil
commited on
Update model_definition.py
Browse files- model_definition.py +21 -1
model_definition.py
CHANGED
|
@@ -13,7 +13,27 @@ from torchvision import transforms
|
|
| 13 |
from functools import partial
|
| 14 |
from typing import Optional, List
|
| 15 |
from torch import Tensor
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
# مكتبات إضافية
|
| 18 |
import os
|
| 19 |
import json
|
|
|
|
| 13 |
from functools import partial
|
| 14 |
from typing import Optional, List
|
| 15 |
from torch import Tensor
|
| 16 |
+
import os
|
| 17 |
+
import json
|
| 18 |
+
import numpy as np
|
| 19 |
+
import cv2
|
| 20 |
+
from PIL import Image
|
| 21 |
+
import torch
|
| 22 |
+
import torch.nn as nn
|
| 23 |
+
import torch.nn.functional as F
|
| 24 |
+
from torchvision import transforms
|
| 25 |
+
from functools import partial
|
| 26 |
+
from collections import deque, OrderedDict
|
| 27 |
+
import math
|
| 28 |
+
from torch.nn import MultiheadAttention
|
| 29 |
+
from torch.nn import TransformerEncoder, TransformerEncoderLayer
|
| 30 |
+
from torch.nn import TransformerDecoder, TransformerDecoderLayer
|
| 31 |
+
from timm.models.resnet import resnet50d, resnet26d, resnet18d
|
| 32 |
+
try:
|
| 33 |
+
from timm.layers import trunc_normal_
|
| 34 |
+
except ImportError:
|
| 35 |
+
from timm.models.layers import trunc_normal_
|
| 36 |
+
from scipy.ndimage import maximum_filter
|
| 37 |
# مكتبات إضافية
|
| 38 |
import os
|
| 39 |
import json
|